Ejemplo n.º 1
0
        public void UpdateStatus()
        {
            if (CurrentHitPoints > MaxHitPoints)
            {
                CurrentHitPoints = MaxHitPoints;
            }
            if (CurrentHitPoints < 0)
            {
                CurrentHitPoints = 0;
            }
            if (CurrentShieldPoints > MaxShieldPoints)
            {
                CurrentShieldPoints = MaxShieldPoints;
            }
            if (CurrentShieldPoints < 0)
            {
                CurrentShieldPoints = 0;
            }

            if (this is Player player)
            {
                player.SendCommand(AttributeHitpointUpdateCommand.write(CurrentHitPoints, MaxHitPoints, CurrentNanoHull, MaxNanoHull));
                player.SendCommand(AttributeShieldUpdateCommand.write(player.CurrentShieldPoints, player.MaxShieldPoints));
                player.SendCommand(SetSpeedCommand.write(player.Speed, player.Speed));
                player.Group?.UpdateTarget(player, new List <command_i3O> {
                    new GroupPlayerInformationsModule(player.CurrentHitPoints, player.MaxHitPoints, player.CurrentShieldPoints, player.MaxShieldPoints, player.CurrentNanoHull, player.MaxNanoHull)
                });
            }
            else if (this is Pet pet)
            {
                var owner = pet.Owner;
                owner.SendCommand(PetHitpointsUpdateCommand.write(pet.CurrentHitPoints, pet.MaxHitPoints, false));
                owner.SendCommand(PetShieldUpdateCommand.write(pet.CurrentShieldPoints, pet.MaxShieldPoints));
            }

            foreach (var otherCharacter in Spacemap?.Characters.Values)
            {
                if (otherCharacter is Player otherPlayer && otherPlayer.Selected == this)
                {
                    if (this is Character character)
                    {
                        otherPlayer.SendCommand(ShipSelectionCommand.write(Id, character.Ship.Id, CurrentShieldPoints, MaxShieldPoints, CurrentHitPoints, MaxHitPoints, CurrentNanoHull, MaxNanoHull, (this is Player && (this as Player).SkillTree.shieldEngineering == 5)));
                    }
                    else if (this is Activatable activatable)
                    {
                        otherPlayer.SendCommand(AssetInfoCommand.write(
                                                    activatable.Id,
                                                    activatable.GetAssetType(),
                                                    activatable is Satellite ? (activatable as Satellite).DesignId : 0,
                                                    0,
                                                    activatable.CurrentHitPoints,
                                                    activatable.MaxHitPoints,
                                                    activatable.MaxShieldPoints > 0 ? true : false,
                                                    activatable.CurrentShieldPoints,
                                                    activatable.MaxShieldPoints
                                                    ));
                    }
                }
            }
        }
Ejemplo n.º 2
0
 public override void Action(Player player)
 {
     if (player.Attackable())
     {
         player.Storage.underSLM_01     = true;
         player.Storage.underSLM_01Time = DateTime.Now;
         player.SendPacket("0|n|fx|start|SABOTEUR_DEBUFF|" + player.Id + "");
         player.SendPacketToInRangePlayers("0|n|fx|start|SABOTEUR_DEBUFF|" + player.Id + "");
         player.SendCommand(SetSpeedCommand.write(player.Speed, player.Speed));
     }
 }
Ejemplo n.º 3
0
        public void DeactiveR_RIC3()
        {
            if (underR_IC3)
            {
                underR_IC3 = false;

                if (Character is Player player)
                {
                    player.SendPacket("0|n|fx|end|ICY_CUBE|" + Character.Id + "");
                    player.SendCommand(SetSpeedCommand.write(Character.Speed, Character.Speed));
                }

                Character.SendPacketToInRangePlayers("0|n|fx|end|ICY_CUBE|" + Character.Id + "");
            }
        }
Ejemplo n.º 4
0
        public void DeactiveSLM_01()
        {
            if (underSLM_01)
            {
                underSLM_01 = false;

                if (underSLM_01Time < underDCR_250Time || !underDCR_250)
                {
                    if (Character is Player)
                    {
                        (Character as Player).SendPacket("0|n|fx|end|SABOTEUR_DEBUFF|" + Character.Id + "");
                    }

                    Character.SendPacketToInRangePlayers("0|n|fx|end|SABOTEUR_DEBUFF|" + Character.Id + "");
                }

                if (Character is Player)
                {
                    (Character as Player).SendCommand(SetSpeedCommand.write(Character.Speed, Character.Speed));
                }
            }
        }
Ejemplo n.º 5
0
        public static void SendPlayer(Player player)
        {
            try
            {
                player.SendCommand(player.GetShipInitializationCommand());

                if (player.Title != "")
                {
                    player.SendPacket($"0|n|t|{player.Id}|1|{player.Title}");
                }

                player.SendPacket(player.DroneManager.GetDronesPacket());
                player.SendCommand(DroneFormationChangeCommand.write(player.Id, DroneManager.GetSelectedFormationId(player.Settings.InGameSettings.selectedFormation)));
                player.SendPacket("0|S|CFG|" + player.CurrentConfig);

                player.SendPacket($"0|A|BK|{player.Equipment.Items.BootyKeys}");
                //player.SendPacket("0|A|JV|0"); //atlama kuponu miktarı

                if (player.Group != null)
                {
                    player.Group.InitializeGroup(player);
                }

                var spaceball = EventManager.Spaceball.Character;
                if (EventManager.Spaceball.Active && spaceball != null)
                {
                    player.SendPacket($"0|n|ssi|{spaceball.Mmo}|{spaceball.Eic}|{spaceball.Vru}");
                }
                else
                {
                    player.SendPacket($"0|n|ssi|0|0|0");
                }

                /*
                 * var priceList = new List<JumpCPUPriceMappingModule>();
                 * var price = new List<int>();
                 * price.Add(1);
                 * price.Add(14);
                 * price.Add(15);
                 * price.Add(16);
                 * priceList.Add(new JumpCPUPriceMappingModule(0, price));
                 * player.SendCommand(JumpCPUUpdateCommand.write(priceList));
                 *
                 * player.SendCommand(CpuInitializationCommand.write(true, false));
                 */
                //player.SendPacket("0|A|JCPU|S|20|1"); //ATLAMA GERİ SAYIM

                player.SendCommand(SetSpeedCommand.write(player.Speed, player.Speed));
                player.Spacemap.SendObjects(player);

                player.BoosterManager.Update();

                if (player.Pet != null)
                {
                    player.SendCommand(PetInitializationCommand.write(true, true, !player.Settings.InGameSettings.petDestroyed));

                    if (player.Settings.InGameSettings.petDestroyed)
                    {
                        player.SendCommand(PetUIRepairButtonCommand.write(true, 250));
                    }
                }

                player.UpdateStatus();

                //player.SendCommand(UbaWindowInitializationCommand.write(new Ubas3wModule(new UbaG3FModule(0, 0, 0, 0), new Uba64iModule("", 0, new //List<UbaHtModule>()), new UbahsModule(new List<Ubal4bModule>())), 0));


                //player.SendCommand(VideoWindowCreateCommand.write(1, "l", true, new List<string> { "start_head", "tutorial_video_msg_reward_premium_intro" }, 1, 1));

                //player.SendPacket("0|n|KSMSG|start_head");


                //player.SendCommand(command_e4W.write(1, "", new class_oS(0, 0, 0, 0, 0, 0, 0, 0, 0, 0), "", new class_s16(1, class_s16.varC3p), 1));

                //player.SendCommand(command_z3Q.write(command_z3Q.varC2f));

                /*
                 * var contacts = new List<class_i1d>();
                 *
                 * var DDDDD = new List<class_84I>();
                 *
                 *
                 * var DDDDsD = new List<class_533>();
                 * DDDDsD.Add(new class_533(class_533.varN2g));
                 *
                 * contacts.Add(new class_i1d(new class_O4f(2, DDDDD), new class_y3i(2, DDDDsD)));
                 * contacts.Add(new class_i1d(new class_O4f(1, DDDDD), new class_y3i(1, DDDDsD)));
                 *
                 * player.SendCommand(ContactsListUpdateCommand.write(new class_o3q(contacts), new class_g1a(true, true, true, true), new class_H4Q(false)));
                 */

                /*
                 * if (isLogin)
                 * {
                 * UBA SEASON
                 *
                 *  var ht = new List<UbaHtModule>();
                 *  var j3s = new List<command_j3s>();
                 *  j3s.Add(new Ubaf3kModule("currency_uridium", 250000));
                 *  ht.Add(new UbaHtModule("asddas", j3s));
                 *
                 *  var l4b = new List<Ubal4bModule>();
                 *  l4b.Add(new Ubal4bModule("Bilmemne Sezonu", 2));
                 *
                 *  player.SendCommand(UbaWindowInitializationCommand.write(new Ubas3wModule(new UbaG3FModule(55, 60, 5, 333443), new Uba64iModule("Yaz Sezonu", 1, ht), new UbahsModule(l4b)), 0));
                 * }
                 */

                player.SendCommand(player.GetBeaconCommand());
            }
            catch (Exception e)
            {
                Out.WriteLine("UID: " + player.Id + " SendPlayerItems void exception: " + e, "LoginRequestHandler.cs");
                Logger.Log("error_log", $"- [LoginRequestHandler.cs] SendPlayerItems void exception: {e}");
            }
        }
        public async void RocketAttack()
        {
            var enemy = Player.SelectedCharacter;

            if (enemy == null)
            {
                return;
            }

            if (Player.Settings.InGameSettings.selectedRocket != AmmunitionManager.WIZ_X)
            {
                if (!Player.TargetDefinition(enemy, true, true))
                {
                    return;
                }
            }

            switch (GetSelectedRocket())
            {
            case 5:
                if (pld8Cooldown.AddMilliseconds(TimeManager.PLD8_COOLDOWN) < DateTime.Now || Player.Storage.GodMode)
                {
                    Player.SendCooldown(AmmunitionManager.PLD_8, TimeManager.PLD8_COOLDOWN);
                    pld8Cooldown = DateTime.Now;
                }
                else
                {
                    return;
                }
                break;

            case 6:
                if (wiz_xCooldown.AddMilliseconds(TimeManager.WIZARD_COOLDOWN) < DateTime.Now || Player.Storage.GodMode)
                {
                    Player.SendCooldown(AmmunitionManager.WIZ_X, TimeManager.WIZARD_COOLDOWN);
                    wiz_xCooldown = DateTime.Now;
                }
                else
                {
                    return;
                }
                break;

            case 10:
                if (dcr_250Cooldown.AddMilliseconds(TimeManager.DCR_250_COOLDOWN) < DateTime.Now || Player.Storage.GodMode)
                {
                    Player.SendCooldown(AmmunitionManager.DCR_250, TimeManager.DCR_250_COOLDOWN);
                    dcr_250Cooldown = DateTime.Now;
                }
                else
                {
                    return;
                }
                break;

            case 18:
                if (r_ic3Cooldown.AddMilliseconds(TimeManager.R_IC3_COOLDOWN) < DateTime.Now || Player.Storage.GodMode)
                {
                    Player.SendCooldown(AmmunitionManager.R_IC3, TimeManager.R_IC3_COOLDOWN);
                    r_ic3Cooldown = DateTime.Now;
                }
                else
                {
                    return;
                }
                break;

            default:
                if (lastRocketAttack.AddSeconds(Player.RocketSpeed) < DateTime.Now)
                {
                    Player.SendCooldown(AmmunitionManager.R_310, Player.Premium ? 1000 : 3000);
                    lastRocketAttack = DateTime.Now;
                }
                else
                {
                    return;
                }
                break;
            }

            Player.CpuManager.DisableCloak();

            var rocketRunPacket = $"0|v|{Player.Id}|{enemy.Id}|H|{GetSelectedRocket()}|{(Player.SkillTree.rocketFusion == 5 ? 1 : 0)}|{(Player.Storage.PrecisionTargeter || Player.SkillTree.heatseekingMissiles == 5 ? 1 : 0)}";

            Player.SendPacket(rocketRunPacket);
            Player.SendPacketToInRangePlayers(rocketRunPacket);

            await Task.Delay(1000);

            UpdateAttacker(enemy, Player);

            switch (GetSelectedRocket())
            {
            case 5:
            case 6:
            case 18:
                if (Player.RocketMissProbability < Randoms.random.NextDouble() && (!(enemy is Player) || (enemy is Player && (enemy as Player).Attackable())))
                {
                    switch (GetSelectedRocket())
                    {
                    case 5:
                        enemy.Storage.underPLD8     = true;
                        enemy.Storage.underPLD8Time = DateTime.Now;

                        if (enemy is Player)
                        {
                            (enemy as Player).SendPacket("0|n|MAL|SET|" + enemy.Id + "");
                        }

                        enemy.SendPacketToInRangePlayers("0|n|MAL|SET|" + enemy.Id + "");
                        break;

                    case 6:
                        var shipId = Ship.GetRandomShipId(enemy.Ship.Id);
                        enemy.AddVisualModifier(VisualModifierCommand.WIZARD_ATTACK, 0, GameManager.GetShip(shipId).LootId, 0, true);
                        break;

                    case 18:
                        enemy.Storage.underR_IC3     = true;
                        enemy.Storage.underR_IC3Time = DateTime.Now;

                        if (enemy is Player)
                        {
                            (enemy as Player).SendPacket("0|n|fx|start|ICY_CUBE|" + enemy.Id + "");
                            (enemy as Player).SendCommand(SetSpeedCommand.write(enemy.Speed, enemy.Speed));
                        }

                        enemy.SendPacketToInRangePlayers("0|n|fx|start|ICY_CUBE|" + enemy.Id + "");
                        break;

                    case 10:
                        if (enemy is Player enemyPlayer)
                        {
                            enemyPlayer.Storage.underDCR_250     = true;
                            enemyPlayer.Storage.underDCR_250Time = DateTime.Now;

                            enemyPlayer.SendPacket("0|n|fx|start|SABOTEUR_DEBUFF|" + enemyPlayer.Id + "");
                            enemyPlayer.SendCommand(SetSpeedCommand.write(enemyPlayer.Speed, enemyPlayer.Speed));

                            enemyPlayer.SendPacketToInRangePlayers("0|n|fx|start|SABOTEUR_DEBUFF|" + enemyPlayer.Id + "");
                        }
                        break;
                    }
                }
                else
                {
                    AttackMissed(enemy, DamageType.ROCKET);
                }
                break;

            default:
                var damage = RandomizeDamage(Player.RocketDamage, Player.RocketMissProbability);
                Damage(Player, enemy, DamageType.ROCKET, damage, 0);
                break;
            }
        }