public BanPlayerViewModel(string playerGuid, bool isOnline, PlayerHelper playerHelper, string playerName, string playerNum) { _playerGuid = playerGuid; _isOnline = isOnline; _playerHelper = playerHelper; _playerName = playerName; _playerNum = playerNum; _minutes = 0; }
public PlayerListModelView(ILog log, UpdateClient updateClient, Guid serverId) { _log = log; _updateClient = updateClient; _serverId = serverId; _playerHelper = new PlayerHelper(_log, serverId, _updateClient); _selectedOptions = "Name,IP,Guid,Comment"; }
public KickPlayerWindow(PlayerHelper playerHelper, Helpers.Views.PlayerView playerView) { _playerHelper = playerHelper; _playerView = playerView; InitializeComponent(); Model = new KickPlayerViewModel(playerView); this.DataContext = Model; }
/// <summary> /// Обработчик точки маршрута /// </summary> protected void PlayerEnterPoint(NetHandle entity, int pointNumber, int dimension) { PlayerHelper.ProcessAction(entity, player => { if (!player.hasData(PlayerData.ON_RACE) || !player.hasData(GetPointKey(pointNumber))) { return; } player.resetData(GetPointKey(pointNumber)); if (pointNumber != LastPoint) { ShowNextPoint(player, ++pointNumber, dimension); } else { AddWinner(player); API.triggerClientEvent(player, ServerEvent.HIDE_RACE_POINT); } }, true); }
public static bool SetRank(string playerName, int rank) { Client target = NAPI.Player.GetPlayerFromName(playerName); if (target == null) { return(false); } PlayerInfo tarInfo = PlayerHelper.GetPlayerStats(target); if (tarInfo == null) { return(false); } if (rank == 1) { tarInfo.last_location = new double[] { 447.9005, -973.0226, 30.68961 }; tarInfo.Update(); target.SendChatMessage("[~y~Fraktion~w~]: Vous avez été invité à la faction ~b~LSPD~w~ !"); } if (rank == 2) { tarInfo.last_location = new double[] { 1151.196, -1529.605, 35.36937 }; tarInfo.Update(); target.SendChatMessage("[~y~Fraktion~w~]: Vous avez été invité à la faction ~b~SARU~w~ !"); } if (rank == 3) { tarInfo.last_location = new double[] { 85.90534, -1956.926, 20.74745 }; tarInfo.Update(); target.SendChatMessage("[~y~Fraktion~w~]: Vous avez été invité à la faction ~b~Grove Street~w~ !"); } tarInfo.fraktion = rank; tarInfo.Update(); PlayerData.Respawn(target); return(true); }
/// <summary> /// Executes the command and sends response. /// Creates player if not exists /// </summary> /// <param name="s">The session.</param> /// <param name="p">The package info.</param> public override void ExecuteCommand(Session s, Package p) { PacketBRequestSessionHandShake Request = new PacketBRequestSessionHandShake(p.Content); Logger.Debug($"{p.Key}::ExecuteCommand - Execute command: {Request}"); if (!s.IsAuthenticated) { if (!PlayerHelper.PlayerNameExists(Request.PlayerName)) { if ((PlayerHelper.IsValidPlayerName(Request.PlayerName)) && (PlayerHelper.IsValidPasswordLength(Request.Password))) { Logger.Info($"{p.Key}::ExecuteCommand - Create new player {Request.PlayerName} from IP {s.RemoteEndPoint.Address.ToString()}"); Player NewObjPlayer = new Player(); NewObjPlayer.Name = Request.PlayerName; NewObjPlayer.Password = PlayerHelper.CreateHash(Request.Password); NewObjPlayer.Save(false, false, true); } } Player ObjPlayer = Database.Players.Get(Request.PlayerName, Request.Password); if (ObjPlayer != null) { s.Player = ObjPlayer; } } PacketBResponseSessionHandShake ResponseContent = new PacketBResponseSessionHandShake(1); Logger.Debug($"{p.Key}::ExecuteCommand - Execute command: {ResponseContent}"); byte[] Response = ResponseContent.ToByteArray(); Package Package = new Package(p.HeaderXuid, p.HeaderField20, p.HeaderServiceId, p.HeaderField22, PacketTypes.BResponseSessionHandShake, p.HeaderRequestId, Response); byte[] ToSend = Package.ToByteArray(); s.Send(ToSend, 0, ToSend.Length); }
public void OnPlayerEnterSARUVehicle(Client client, Vehicle vehicle, sbyte seatID) { PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(client); uint ambulance = NAPI.Util.GetHashKey("ambulance"); uint firetruk = NAPI.Util.GetHashKey("firetruk"); if (vehicle.Model == ambulance || vehicle.Model == firetruk) { if (client.VehicleSeat == -1) { if (!FraktionSystem.HasRank(client, 2)) { client.SendNotification("~r~Du bist dazu nicht befugt!"); client.WarpOutOfVehicle(); } } } }
public void CMD_FraktionWarn(Client client, Client player) { //Spieler Statistiken PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(player); //Abfrage ob man ein Leader ist if (!LeaderSystem.IsLeader(client)) { client.SendNotification("~r~Du bist kein Leader!"); return; } if (!LeaderSystem.Same(client, player)) { client.SendNotification("~r~Ihr befindet euch nicht in der selben Fraktion!"); return; } if (client.Name == player.Name) { client.SendNotification("~r~Du kannst dich nicht selber angeben!"); return; } playerInfo.fwarn += 1; playerInfo.Update(); player.SendChatMessage($"[~g~Fraktion~w~]: Du bekamst eine Verwarnung und besitzt nun ~r~{playerInfo.fwarn}~w~ Verwarnungen."); if (playerInfo.fwarn == 3) { player.SendChatMessage("[~g~Fraktion~w~]: Du besitzt zu viele Verwarnungen weswegen du aus der Fraktion entlassen wurdest!"); player.SendNotification("~r~Du wurdest aus der Fraktion entlassen!"); playerInfo.fraktion = 0; playerInfo.last_location = new double[] { -1167.994, -700.4285, 21.89281 }; playerInfo.Update(); PlayerData.Respawn(player); } }
public void SlashAbilityUnitTest() { Player player = new Player("test", PlayerClassType.Warrior) { MaxRagePoints = 100, RagePoints = 100 }; OutputHelper.Display.ClearUserOutput(); Monster monster = new Monster(3, MonsterType.Demon) { HitPoints = 100, MaxHitPoints = 100 }; MonsterBuilder.BuildMonster(monster); foreach (IItem item in monster.MonsterItems.Where(item => item is IEquipment eItem && eItem.Equipped)) { IEquipment eItem = item as IEquipment; eItem.Equipped = false; } string[] inputInfo = new[] { "ability", "slash" }; int abilityIndex = player.Abilities.FindIndex( f => f.WarAbilityCategory == WarriorAbility.Slash); PlayerHelper.AbilityInfo(player, inputInfo); Assert.AreEqual("Slash", OutputHelper.Display.Output[0][2]); Assert.AreEqual("Rank: 1", OutputHelper.Display.Output[1][2]); Assert.AreEqual("Rage Cost: 40", OutputHelper.Display.Output[2][2]); Assert.AreEqual("Instant Damage: 50", OutputHelper.Display.Output[3][2]); string[] input = new[] { "use", "slash" }; string abilityName = InputHelper.ParseInput(input); Assert.AreEqual("slash", abilityName); player.UseAbility(monster, input); Assert.AreEqual(player.MaxRagePoints - player.Abilities[abilityIndex].RageCost, player.RagePoints); int abilityDamage = player.Abilities[abilityIndex].Offensive.Amount; Assert.AreEqual(monster.HitPoints, monster.MaxHitPoints - abilityDamage); string abilitySuccessString = $"Your {player.Abilities[abilityIndex].Name} hit the {monster.Name} for {abilityDamage} physical damage."; Assert.AreEqual(abilitySuccessString, OutputHelper.Display.Output[4][2]); }
public bool Initialise(out List <string> errors) { Logging.Log.DebugFormat("{0} Initialising {1}", GameId, m_filename); IASL game; if (LoadData != null) { game = GameLauncher.GetGame(Convert.FromBase64String(LoadData), ApiGameData.ASLVersion, ApiGameData.SourceGameUrl); } else { game = GameLauncher.GetGame(m_filename, LibraryFolder); } m_controller = new PlayerHelper(game, this); m_controller.UseGameColours = true; m_controller.UseGameFont = true; m_controller.Game.LogError += LogError; m_controller.Game.UpdateList += UpdateList; m_controller.Game.Finished += GameFinished; IASLTimer gameTimer = game as IASLTimer; if (gameTimer != null) { gameTimer.RequestNextTimerTick += RequestNextTimerTick; } bool success = m_controller.Initialise(this, out errors); if (success) { Logging.Log.DebugFormat("{0} Initialised successfully", GameId); } else { Logging.Log.WarnFormat("{0} Failed to initialise game - errors found in file", GameId); } return(success); }
public void OnExecute() { return; var Player = ObjectManager.Player; Vector2 drakeWallQPos = new Vector2(11514, 4462); Vector2 midWallQPos = new Vector2(6667, 8794); if (Player.Distance(midWallQPos) >= Player.Distance(drakeWallQPos)) { if (Player.Position.X < 12000 || Player.Position.X > 12070 || Player.Position.Y < 4800 || Player.Position.Y > 4872) { PlayerHelper.MoveToLimited(new Vector2(12050, 4827).To3D()); } else { PlayerHelper.MoveToLimited(new Vector2(12050, 4827).To3D()); LeagueSharp.Common.Utility.DelayAction.Add((int)(106 + Game.Ping / 2f), () => { Variables.spells[SpellSlot.Q].Cast(drakeWallQPos); }); } } else { if (Player.Position.X < 6908 || Player.Position.X > 6978 || Player.Position.Y < 8917 || Player.Position.Y > 8989) { PlayerHelper.MoveToLimited(new Vector2(6962, 8952).To3D()); } else { PlayerHelper.MoveToLimited(new Vector2(6962, 8952).To3D()); LeagueSharp.Common.Utility.DelayAction.Add((int)(106 + Game.Ping / 2f), () => { Variables.spells[SpellSlot.Q].Cast(midWallQPos); }); } } }
public void CMD_FraktionWarn(Client client, Client player) { //Spieler Statistiken PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client); PlayerInfo playerInfo = PlayerHelper.GetPlayerStats(player); //Abfrage ob man ein Leader ist if (!LeaderSystem.IsLeader(client)) { client.SendNotification("~r~Vous n'êtes pas un leader!"); return; } if (!LeaderSystem.Same(client, player)) { client.SendNotification("~r~Vous n'êtes pas dans la même faction!"); return; } if (client.Name == player.Name) { client.SendNotification("~r~Vous ne pouvez pas vous spécifier!"); return; } playerInfo.fwarn += 1; playerInfo.Update(); player.SendChatMessage($"[~g~Fraktion~w~]: Vous avez reçu un avertissement. ~r~{playerInfo.fwarn}~w~ avertissements."); if (playerInfo.fwarn == 3) { player.SendChatMessage("[~g~Fraktion~w~]: Vous avez trop d'avertissements sur la raison pour laquelle vous avez été libéré de la faction!"); player.SendNotification("~r~Vous avez été renvoyé du groupe!"); playerInfo.fraktion = 0; playerInfo.last_location = new double[] { -1167.994, -700.4285, 21.89281 }; playerInfo.Update(); PlayerData.Respawn(player); } }
public void SwiftAuraAbilityUnitTest() { OutputHelper.Display.ClearUserOutput(); Player player = new Player("placeholder", PlayerClassType.Archer); GearHelper.EquipInitialGear(player); OutputHelper.Display.ClearUserOutput(); player.Abilities.Add(new PlayerAbility( "swift aura", 150, 1, ArcherAbility.SwiftAura, 6)); string[] input = new[] { "use", "swift", "aura" }; PlayerHelper.AbilityInfo(player, input); Assert.AreEqual("Swift Aura", OutputHelper.Display.Output[0][2]); Assert.AreEqual("Rank: 1", OutputHelper.Display.Output[1][2]); Assert.AreEqual("Combo Cost: 150", OutputHelper.Display.Output[2][2]); Assert.AreEqual("Swift Aura Amount: 15", OutputHelper.Display.Output[3][2]); Assert.AreEqual("Dexterity is increased by 15 for 10 minutes.", OutputHelper.Display.Output[4][2]); int baseDex = player.Dexterity; int?baseCombo = player.ComboPoints; int?baseMaxCombo = player.MaxComboPoints; int abilityIndex = player.Abilities.FindIndex(f => f.Name == InputHelper.ParseInput(input)); player.UseAbility(input); Assert.AreEqual(player.Dexterity, baseDex + player.Abilities[abilityIndex].ChangeAmount.Amount); Assert.AreEqual( baseCombo - player.Abilities[abilityIndex].ComboCost, player.ComboPoints); Assert.AreEqual( player.MaxComboPoints, baseMaxCombo + (player.Abilities[abilityIndex].ChangeAmount.Amount * 10)); Assert.AreEqual("You generate a Swift Aura around yourself.", OutputHelper.Display.Output[5][2]); ChangeStatEffect changeStatEffect = player.Effects[0] as ChangeStatEffect; for (int i = 1; i < 601; i++) { Assert.AreEqual(i, player.Effects[0].CurrentRound); changeStatEffect.ProcessChangeStatRound(player); } GameHelper.RemovedExpiredEffectsAsync(player); Thread.Sleep(1000); Assert.AreEqual(false, player.Effects.Any()); Assert.AreEqual(baseDex, player.Dexterity); Assert.AreEqual(baseMaxCombo, player.MaxComboPoints); Assert.AreEqual(baseCombo - player.Abilities[abilityIndex].ComboCost, player.ComboPoints); }
/// <summary> /// Покупка телефона /// </summary> private void BuyPhone(Client player, object[] args) { var price = (int)args[0]; var playerInfo = _playerInfoManager.GetInfo(player); if (!PlayerHelper.EnoughMoney(player, playerInfo, price)) { return; } if (playerInfo.PhoneNumber != 0) { API.sendNotificationToPlayer(player, "~r~У вас уже есть телефон", true); return; } playerInfo.Balance -= price; _playerInfoManager.SetPhoneNumber(player); player.setSyncedData("HasPhone", true); API.sendNotificationToPlayer(player, $"~b~Приобретен моб. телефон. Списано {price}$"); _playerInfoManager.RefreshUI(player, playerInfo); }
public static void OnCreateMove(CUserCmd *pCmd) { if ((pCmd->buttons & IN_ATTACK) == 0) { return; } PlayerHelper pEntity = GetTarget(pCmd); if (!pEntity.IsValid()) { return; } QAngle targetAngle = SpacialUtils.CalcAngle(Utils.GetLocalPlayer().GetEyePos(), pEntity.GetEyePos()); targetAngle.Normalize(); pCmd->viewangles = pCmd->viewangles.Add(targetAngle.Subtract(pCmd->viewangles).Divide(2)); pCmd->viewangles.Normalize(); }
/// <summary> /// Создает админа на ресепшене /// </summary> private void CreateAdmin(ClanInfo clanInfo) { var ped = _pointCreator.CreatePed( clanInfo.AdminHash, "Администратор", clanInfo.AdminPosition, clanInfo.AdminRotation, clanInfo.AdminMarker, Colors.VividCyan ); ped.ColShape.onEntityEnterColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => { var playerInfo = _playerInfoManager.GetInfo(player); if (playerInfo.Clan != null && playerInfo.Clan.ClanId != clanInfo.ClanId) { API.sendColoredNotificationToPlayer(player, "Вы состоите в другой банде", 0, 6, true); return; } API.triggerClientEvent(player, ServerEvent.SHOW_CLAN_MENU, (int)clanInfo.ClanId); }); ped.ColShape.onEntityExitColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => API.triggerClientEvent(player, ServerEvent.HIDE_CLAN_MENU)); }
public CoverPage() { this.InitializeComponent(); this.navigationHelper = new NavigationHelper(this); this.navigationHelper.LoadState += navigationHelper_LoadState; NavigationCacheMode = Windows.UI.Xaml.Navigation.NavigationCacheMode.Required; if (GlobalVariables.CurrentPlayerState == null) { GlobalVariables.CurrentPlayerState = new PlayerState(); } DataContext = GlobalVariables.CurrentPlayerState; PlayerHelper.RefreshPlayerState().Wait(200); timer = new DispatcherTimer(); timer.Interval = TimeSpan.FromSeconds(1); timer.Start(); timer.Tick += timer_Tick; }
private static bool HasLongestDistanceToOpponent() { var zasranech = PlayerHelper.GetPuckOwner(); var myDistance = Current.Hockeyist.GetDistanceTo(zasranech); //if (Current.SaferCount < PlayerHelper.GetTeammatesCount() - 1) if (Current.SaferCount < 1) { return(Current.World.Hockeyists.Any( // there is no hock with less distance (hock) => { if (hock.IsTeammate && hock.Type != HockeyistType.Goalie && hock.TeammateIndex != Current.Hockeyist.TeammateIndex) { return hock.GetDistanceTo(zasranech) > myDistance; } return false; })); } return(true); }
private Composite createTree() { return(new Decorator(x => TreeHelper.canTick() && !PlayerHelper.isPlayerDead() && (!Cache.InHideout || Settings.EnableInHideout), new PrioritySelector ( new Decorator(x => Settings.AutoFlask, new PrioritySelector( createInstantHPPotionComposite(), createHPPotionComposite(), createInstantManaPotionComposite(), createManaPotionComposite() ) ), createAilmentPotionComposite(), createDefensivePotionComposite(), createSpeedPotionComposite(), createOffensivePotionComposite() ) )); }
public void CMD_Warn(Client client, Client player) { //Spieler Statistiken PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client); Players playerInfo = PlayerHelper.GetPlayer(player); BanLog banLog = PlayerHelper.BanLogs(player); //Abfrage ob man ein Leader ist if (!AdminSystem.HasRank(client, 1)) { client.SendNotification("~r~Du bist kein Admin!"); return; } if (client.Name == player.Name) { client.SendNotification("~r~Du kannst dich nicht selber angeben!"); return; } playerInfo.warn += 1; playerInfo.Update(); player.SendChatMessage($"[~r~Server~w~]: Du bekamst eine Verwarnung und besitzt nun ~r~{playerInfo.warn}~w~ Verwarnungen."); if (playerInfo.warn == 3) { player.SendChatMessage("[~r~Server~w~]: Du besitzt zu viele Verwarnungen weswegen du auf diesem Server gesperrt wurdest!"); playerInfo.ban = 1; playerInfo.Update(); banLog = new BanLog(); banLog.banned = player.Name; banLog.bannedby = client.Name; banLog.grund = "3_Verwarnungen"; banLog.Upsert(); player.Kick(); } }
public static Item AddItemToCharacter(Character character, Item item) { ServerDbContext dbContext = ((GameMode)GameMode.Instance).DbContext; if (character.Inventory == null) { throw new InventoryAddingExceptions("Le joueur n'a pas d'inventaire."); } if (item is Phone) { if (((Phone)item).DefaultPhone) { if (PhoneHelper.GetDefaultPhone(character) != null) { ((Phone)item).DefaultPhone = false; } } } if (character.ItemInHand == null) { character.ItemInHand = item; dbContext.SaveChanges(); if (item is Gun) { Player player = PlayerHelper.SearchCharacter(character); player.GiveWeapon(((Gun)item).idWeapon, ((Gun)item).Quantity); } return(item); } else if (character.Inventory.ListItems.Count() < character.Inventory.MaxSpace) { item.CurrentContainer = character.Inventory; character.Inventory.ListItems.Add(item); dbContext.SaveChanges(); return(item); } else { throw new InventoryAddingExceptions("L'inventaire est complet et la main n'est pas vide."); } }
public void CMD_Warn(Client client, Client player) { //Spieler Statistiken PlayerInfo leaderInfo = PlayerHelper.GetPlayerStats(client); Players playerInfo = PlayerHelper.GetPlayer(player); BanLog banLog = PlayerHelper.BanLogs(player); //Abfrage ob man ein Leader ist if (!AdminSystem.HasRank(client, 1)) { client.SendNotification("~r~Tu n'es pas Admin"); return; } if (client.Name == player.Name) { client.SendNotification("~r~Tu ne peut pas te warn toi même"); return; } playerInfo.warn += 1; playerInfo.Update(); player.SendChatMessage($"[~r~Server~w~]:Vous avez reçu un avertissement, vous avez maintenant ~r~{playerInfo.warn}~w~ avertissement(s)."); if (playerInfo.warn == 3) { player.SendChatMessage("[~r~Server~w~]: Vous avez trop d'avertissements sur la raison pour laquelle vous avez été banni sur ce serveur!"); playerInfo.ban = 1; playerInfo.Update(); banLog = new BanLog(); banLog.banned = player.Name; banLog.bannedby = client.Name; banLog.grund = "3_Verwarnungen"; banLog.Upsert(); player.Kick(); } }
private void onAddButtonClicked() { uiPlayerDialog.Visible = false; uiPlayerDetailDialog = new UIPlayerDetailDialog(gameSystem) { Text = gameSystem.wording.add, okButtonClicked = async() => { var name = uiPlayerDetailDialog.name; if (!checkPlayer(ref name)) { return; } gameSystem.players.Add(new PlayerInfo() { name = name, code = Guid.NewGuid().ToString(), servers = new List <ServerInfo>() }); PlayerHelper.savePlayer(gameSystem.players); uiPlayerDialog.setData(gameSystem.players.Select(o => o.name).ToList()); uiPlayerDetailDialog.Close(); uiPlayerDialog.Visible = true; }, cancelButtonClicked = () => { uiPlayerDetailDialog.Close(); uiPlayerDialog.Visible = true; } }; uiPlayerDetailDialog.Show(); }
/// <summary> /// Обработчик завершения патрулирования /// </summary> private void OnFinishAlert(Client player, object[] args) { if (!player.hasData(WorkData.ALERT_ZONE_KEY)) { API.sendNotificationToPlayer(player, "~r~Вы не находитесь в зоне партрулирования", true); return; } var alertId = (int)player.getData(WorkData.ALERT_ZONE_KEY); if (PlayerHelper.PlayerCorrect(player, true)) { var patrolGroup = API.getPlayersInRadiusOfPlayer(10f, player).Where(e => e != null && e.hasData(WorkData.IS_POLICEMAN)).ToList(); foreach (var policeman in patrolGroup) { _policeRewardManager.SetPatrolReward(policeman); } } _policeAlertManager.FinishAlert(alertId); player.resetData(WorkData.ALERT_ZONE_KEY); API.triggerClientEvent(player, ServerEvent.HIDE_POLICEMAN_MENU); }
public void Update() { var offscreenVector = new Vector2(100f, 100f); var cameraPosition = CameraComponent.Active.Position; var positions = PlayerHelper.GetPlayers() .Select((player, i) => // Currently the camera is included in the borders vertex parameters. // Because of this we need to revert this data or also add it to the player. // The camera data is inverted, so there is not a "+", but a "-"! player.Transform.WorldPosition - cameraPosition ) .Concat(new[] { offscreenVector, offscreenVector, offscreenVector, offscreenVector }) //.Take(4) .ToArray(); SetUniform(PLAYER_POSITION_ATTRIBUTE_NAME + "0", positions[0]); SetUniform(PLAYER_POSITION_ATTRIBUTE_NAME + "1", positions[1]); SetUniform(PLAYER_POSITION_ATTRIBUTE_NAME + "2", positions[2]); SetUniform(PLAYER_POSITION_ATTRIBUTE_NAME + "3", positions[3]); }
/// <summary> /// Main constructor /// </summary> /// <param name="p">the client's process object</param> public Client(Process p) { process = p; process.Exited += new EventHandler(process_Exited); process.EnableRaisingEvents = true; process.WaitForInputIdle(); while (process.MainWindowHandle == IntPtr.Zero) { process.Refresh(); System.Threading.Thread.Sleep(5); } memory = new MemoryHelper(this); player = new PlayerHelper(this); processHandle = p.Handle; startTime = Memory.ReadInt32(Addresses.Client.StartTime); }
/// <summary> /// Возвращает игрока и его данные по идентификатору /// </summary> public PlayerWithData GetWithData(long accountId, bool needFromDb = true) { var player = API.getAllPlayers().FirstOrDefault(e => e.hasData(ID_KEY) && accountId == (long)e.getData(ID_KEY)); if (PlayerHelper.PlayerCorrect(player, true)) { return(new PlayerWithData { Player = player, PlayerInfo = GetInfo(player) }); } PlayerInfo playerInfo = null; if (needFromDb) { playerInfo = _playersProvider.GetInfo(accountId); playerInfo.Vehicles = _vehiclesProvider.GetVehicles(accountId).ToDictionary(e => e.Id); } return(new PlayerWithData { Player = null, PlayerInfo = playerInfo }); }
public void OnPlayerbKonto(Client client, int pin, int repin) { PlayerInfo pInfo = PlayerHelper.GetPlayerStats(client); if (pin != repin) { client.SendChatMessage("Dein Pin stimmt nicht überein!"); client.TriggerEvent("bKontoResult", 0); return; } else { client.SendChatMessage($"[~g~Bank~w~] Dein Pin lautet {pin}"); client.SendChatMessage($"[~g~Bank~w~] Du kannst deinen Pin jederzeit in einer Bank ändern!"); pInfo.bkontopin += pin; pInfo.bkonto += 1; client.TriggerEvent("bKontoResult", 1); Database.Update(pInfo); } }
private void DeletePlayer() { int si = 0; try { si = lsvPlayer.SelectedItems[0].Index; } catch { MessageBox.Show("Please select you wish to delete"); return; } if (DialogResult.OK == MessageBox.Show("Do you really wish to delete [" + listByTeam[si].firstName + " " + listByTeam[si].lastName + "]", "System", MessageBoxButtons.OKCancel)) { PlayerHelper.DeletePlayer(listByTeam[si]); MessageBox.Show("Successfuly deleted"); GetPlayer(); } }
private void RestorePlayerStatToNormal(Player player) { if (EffectStatType is StatType.Intelligence) { player.Intelligence -= _statAmount; } else if (EffectStatType is StatType.Strength) { player.Strength -= _statAmount; } else if (EffectStatType is StatType.Dexterity) { player.Dexterity -= _statAmount; } else if (EffectStatType is StatType.Constitution) { player.Constitution -= _statAmount; } PlayerHelper.CalculatePlayerStats(player); }
/// <summary> /// Создает точку сдачи угнаной машины /// </summary> private void CreateQuestEndPoint(long clanId, Vector3 position) { var endPoint = API.createCylinderColShape(position, 4f, 3f); endPoint.onEntityEnterColShape += (shape, entity) => PlayerHelper.ProcessAction(entity, player => { var playerClanId = PlayerInfoManager.GetInfo(player).Clan?.ClanId ?? Validator.INVALID_ID; if (clanId != playerClanId) { return; } var vehicle = API.getPlayerVehicle(player); if (vehicle.IsNull || !API.hasEntityData(vehicle, THIEFT_VEHICLE)) { return; } API.deleteEntity(vehicle); SetQuestReward(player); ActionHelper.CancelAction(player, CLAN_QUEST_TIMER); API.triggerClientEvent(player, ServerEvent.HIDE_CLAN_QUEST_POINTS); }, true); }
/// <summary> /// Обработчик покупки еды в магазине /// </summary> private void OnBuyFood(Client player, object[] args) { var price = (int)args[1]; var playerInfo = _playerInfoManager.GetInfo(player); if (!PlayerHelper.EnoughMoney(player, playerInfo, price)) { return; } playerInfo.Balance -= price; var satietyCount = (int)args[0]; var newSatiety = playerInfo.Satiety + satietyCount; playerInfo.Satiety = newSatiety <= PlayerInfo.MAX_VALUE ? newSatiety : PlayerInfo.MAX_VALUE; _playerInfoManager.RefreshUI(player, playerInfo); PlayerHelper.PlayEatAnimation(player); var district = (int)args[2]; _clanManager.ReplenishClanBalance(district, price); API.sendNotificationToPlayer(player, $"~b~Списано {price}$"); }
public override void receiveLeftClick(int x, int y, bool playSound = true) { foreach (PlayerBar pb in _playerBars) { if (!pb.online || pb.farmer == Game1.player) { continue; } if (pb.warpButton.containsPoint(x, y)) { PlayerHelper.warpFarmerToPlayer(pb.farmer); } } if (_optionsButton.containsPoint(x, y)) { Game1.activeClickableMenu.exitThisMenuNoSound(); Game1.activeClickableMenu = new OptionsMenu <ModConfig>(ModEntry.Helper, 500, 400, Game1.player.UniqueMultiplayerID, ModEntry.config, this); } base.receiveLeftClick(x, y, playSound); }
/// <summary> /// Main constructor /// </summary> /// <param name="p">the client's process object</param> public Client(Process p) { Process = p; Process.Exited += new EventHandler(process_Exited); Process.EnableRaisingEvents = true; // Wait until we can really access the process Process.WaitForInputIdle(); while (Process.MainWindowHandle == IntPtr.Zero) { Process.Refresh(); System.Threading.Thread.Sleep(5); } // Save a copy of the handle so the process doesn't have to be opened // every read/write operation Handle = Util.WinAPI.OpenProcess(Util.WinAPI.PROCESS_ALL_ACCESS, 0, (uint)Process.Id); PathFinder = new Pokemon.Util.AStarPathFinder(this); Inventory = new Objects.Inventory(this); BattleList = new Objects.BattleList(this); Map = new Objects.Map(this); Memory = new MemoryHelper(this); Window = new Window(this); IO = new IOHelper(this); Login = new LoginHelper(this); Dll = new DllHelper(this); Input = new InputHelper(this); Player = new PlayerHelper(this); // Save the start time (it isn't changing) startTime = Memory.ReadInt32(Addresses.Client.StartTime); }
private void LoadPlayerIntoDatabase(string playerName) { playerName = scripts.PlayerNameFirstLastFromLastFirst(playerName).ToUpper(); //first we have to load the roster page var playerId = GetNHLPlayerIdFromName(playerName); var HTML = GetPageHTML(String.Format("http://avalanche.nhl.com/club/player.htm?id={0}", playerId)); //since these pages are not well formatted XML, we are going to have to do this the hard way var position = GetHTMLInnerDiv(HTML, "plyrTmbPositionTeam\">"); position = position.Substring(0, position.IndexOf("-")); var weight = GetHTMLInnerDiv(HTML, "plyrTmbStatCaption\">Weight:</span>"); var height = GetHTMLInnerDiv(HTML, "plyrTmbStatCaption\">Height:</span>"); var heightInt = scripts.ConvertHeightToInches(height); var dob = GetHTMLInnerDiv(HTML, "plyrTmbStatCaption\">Born:</span>"); dob = dob.Substring(0, dob.IndexOf("(Age")); var insertPlayerName = GetHTMLInnerDiv(HTML, "plyrTmbPlayerName\">"); var birthplace = GetHTMLInnerDiv(HTML, "plyrTmbStatCaption\">Birthplace:</span>"); var birthplaceArr = birthplace.Split(','); birthplace = birthplaceArr.Last(); var helper = new PlayerHelper(); helper.AddPlayerToMSSQL(insertPlayerName, position, dob, birthplace, heightInt, Convert.ToInt32(weight)); }
public BanPlayerWindow(PlayerHelper playerHelper, string playerGuid, bool isOnline, string playerName, string playerNum) { InitializeComponent(); _model = new BanPlayerViewModel(playerGuid, isOnline, playerHelper, playerName, playerNum); tbGuid.IsEnabled = string.IsNullOrEmpty(playerGuid); var tsdata = new List<TimeSpan> { TimeSpan.FromDays(0), TimeSpan.FromDays(1), TimeSpan.FromDays(7), TimeSpan.FromDays(30), }; ts.ItemsSource = tsdata; this.DataContext = _model; }
private void SyncPlayerData() { var helper = new PlayerHelper(); var hisPlayers = helper.GetPlayerListFromMySQL(); var myPlayers = helper.GetPlayerListFromMSSQL(); foreach(var player in myPlayers) { var hisPlayer = hisPlayers.Where(c => c.Id == player.Id).FirstOrDefault(); if(hisPlayer == null) { AddPlayer(helper, player); } else if(hisPlayer.IsCurrent != player.IsCurrent) { UpdatePlayer(helper, player, hisPlayer); } } }
private void UpdatePlayer(PlayerHelper helper, App_Code.Player player, App_Code.Player hisPlayer) { hisPlayer.IsCurrent = player.IsCurrent; helper.UpdateMySQLPlayer(hisPlayer); InfoLabel.Text += String.Format("Updating {0}'s IsCurrent to {1} {2}", player.Name, player.IsCurrent.ToString(), "<br />"); }
/// <summary> /// Main constructor /// </summary> /// <param name="p">the client's process object</param> public Client(Process p) { process = p; process.Exited += new EventHandler(process_Exited); process.EnableRaisingEvents = true; // Wait until we can really access the process process.WaitForInputIdle(); while (process.MainWindowHandle == IntPtr.Zero) { process.Refresh(); System.Threading.Thread.Sleep(5); } // Save a copy of the handle so the process doesn't have to be opened // every read/write operation processHandle = Util.WinApi.OpenProcess(Util.WinApi.PROCESS_ALL_ACCESS, 0, (uint)process.Id); pathFinder = new Tibia.Util.AStarPathFinder(this); contextMenu = new ContextMenu(this); memory = new MemoryHelper(this); window = new WindowHelper(this); io = new IOHelper(this); login = new LoginHelper(this); dll = new DllHelper(this); input = new InputHelper(this); player = new PlayerHelper(this); icon = new Icon(this); skin = new Skin(this); // Save the start time (it isn't changing) startTime = Memory.ReadInt32(Addresses.Client.StartTime); }
private void AddPlayer(PlayerHelper helper, App_Code.Player player) { helper.AddPlayerToMySQL(player); InfoLabel.Text += String.Format("Adding player {0} {1}", player.Name, "<br />"); }