Ejemplo n.º 1
0
        public void CreateBattleStation()
        {
            Building = false;
            var battleStation = new ClanBattleStation(Spacemap.GetNextObjectId(), AssignedBattleStationId, Name, Faction, new Vector(Position.X, Position.Y), Spacemap, Builder, EquippedModules);

            Spacemap.RemoveObject(this);
            GameClient.SendToSpacemap(Spacemap, netty.commands.old_client.AssetRemoveCommand.write(new netty.commands.old_client.AssetTypeModule((short)Type), Id));

            foreach (var module in EquippedModules.Values)
            {
                module.BattleStation = battleStation;
                if (module.SlotId == 0 || module.SlotId == 1)
                {
                    continue;
                }
                module.Position             = BattleStationModule.GetPos(battleStation.Position, module.SlotId);
                Spacemap.Objects[module.Id] = module;
            }

            Spacemap.AddObject(battleStation);
        }
Ejemplo n.º 2
0
 public void RepairModule(BattleStationModule module)
 {
 }
Ejemplo n.º 3
0
 public void SwapModule(BattleStationModule module)
 {
 }
Ejemplo n.º 4
0
        public static BattleStationModule Equip(Player equipper, Module module, Asteroid asteroid, int slotId, int installationTime = 45)
        {
            if (module.Equipped || module.Destroyed || slotId == 0 && module.ModuleType != Module.Types.HULL ||
                slotId == 1 && module.ModuleType != Module.Types.DEFLECTOR || slotId != 0 && module.ModuleType == Module.Types.HULL ||
                slotId != 1 && module.ModuleType == Module.Types.DEFLECTOR || asteroid.EquippedModules.Any(x => x.Value.SlotId == slotId) || (module.ModuleType == Module.Types.DAMAGE_BOOSTER || module.ModuleType == Module.Types.HONOR_BOOSTER || module.ModuleType == Module.Types.EXPERIENCE_BOOSTER) && asteroid.EquippedModules.Values.Any(x =>
                                                                                                                                                                                                                                                                                                                                                  x.Clan == equipper.Clan && (x.ModuleType == Module.Types.DAMAGE_BOOSTER ||
                                                                                                                                                                                                                                                                                                                                                                              x.ModuleType == Module.Types.EXPERIENCE_BOOSTER ||
                                                                                                                                                                                                                                                                                                                                                                              x.ModuleType == Module.Types.HONOR_BOOSTER)))
            {
                return(null);
            }
            module.Equipped = true;
            module.EquippedBattleStationId = asteroid.AssignedBattleStationId;
            BattleStationModule battleStationModule;

            switch (module.ModuleType)
            {
            case Module.Types.LASER_LOW_RANGE:
                battleStationModule = new LaserStationModule(equipper, module, asteroid, module.ModuleType)
                {
                    InstallationActive = true,
                    InstallationStart  = DateTime.Now,
                    InstallationEnd    = DateTime.Now.AddSeconds(installationTime),
                    SlotId             = slotId,
                    Name  = "LTM-LR",
                    Range = 500,
                    Clan  = equipper.Clan
                };
                break;

            case Module.Types.LASER_MID_RANGE:
                battleStationModule = new LaserStationModule(equipper, module, asteroid, module.ModuleType)
                {
                    InstallationActive = true,
                    InstallationStart  = DateTime.Now,
                    InstallationEnd    = DateTime.Now.AddSeconds(installationTime),
                    SlotId             = slotId,
                    Name  = "LTM-MR",
                    Range = 700,
                    Clan  = equipper.Clan
                };
                break;

            case Module.Types.LASER_HIGH_RANGE:
                battleStationModule = new LaserStationModule(equipper, module, asteroid, module.ModuleType)
                {
                    InstallationActive = true,
                    InstallationStart  = DateTime.Now,
                    InstallationEnd    = DateTime.Now.AddSeconds(installationTime),
                    SlotId             = slotId,
                    Name  = "LTM-HR",
                    Range = 1000,
                    Clan  = equipper.Clan
                };
                break;

            default:
                battleStationModule = new BattleStationModule(equipper, module, asteroid, module.ModuleType)
                {
                    InstallationActive = true,
                    InstallationStart  = DateTime.Now,
                    InstallationEnd    = DateTime.Now.AddSeconds(installationTime),
                    SlotId             = slotId,
                    Clan = equipper.Clan
                };
                break;
            }
            module.BattleStationModule = battleStationModule;
            return(battleStationModule);
        }