Example #1
0
        /// <summary>
        /// Checks whether the required location is free
        /// </summary>
        /// <param name="prototype"></param>
        /// <param name="location"></param>
        /// <returns></returns>
        public bool IsFreeLocation(BaseShip prototype, Location location)
        {
            var dj = 0;
            var di = 0;

            Logger.Debug("Attempt to get prospective direction");
            switch (prototype.Orientation)
            {
            case Orientation.Horizontal:
                dj = 1;
                break;

            case Orientation.Vertical:
                di = 1;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
            Logger.Debug("Attempt to get prospective direction successfully completed. Direction is " + di + " " + dj);
            for (var i = 0; i < prototype.Size; i++)
            {
                if ((GeneralFunction.PreventionIndexRange(location.I + i * di, location.J + i * dj)) &&
                    (!CompletingCell[location.I + i * di, location.J + i * dj]))
                {
                    continue;
                }
                Logger.Debug("Attempt to mark cell location like not valid");
                NotvalidCellLocation[location.I, location.J] = true;
                return(false);
            }
            Logger.Debug("Attempt to mark cell location like not valid successfully completed");
            return(true);
        }
Example #2
0
 protected BaseShipItem(BaseShip ship, int itemID, Point3D initOffset)
     : base(itemID)
 {
     Location = initOffset;
     Movable = false;
     ship.Embark(this);
 }
Example #3
0
        public static BaseShip RandomizeShip(Dictionary <Type, int> shipChances)
        {
            BaseShip ship = null;

            int TotalValues = 0;

            foreach (KeyValuePair <Type, int> pair in shipChances)
            {
                TotalValues += pair.Value;
            }

            double ActionCheck      = Utility.RandomDouble();
            double CumulativeAmount = 0.0;
            double AdditionalAmount = 0.0;

            bool foundDirection = true;

            foreach (KeyValuePair <Type, int> pair in shipChances)
            {
                AdditionalAmount = (double)pair.Value / (double)TotalValues;

                if (ActionCheck >= CumulativeAmount && ActionCheck < (CumulativeAmount + AdditionalAmount))
                {
                    ship = (BaseShip)Activator.CreateInstance(pair.Key);
                    break;
                }

                CumulativeAmount += AdditionalAmount;
            }

            return(ship);
        }
Example #4
0
    // Get the nearest target
    void GetNearestTarget(bool isOnPlayerSide, int desiredClass)
    {
        float tempDistance = 0;
        float distance     = 0;
        bool  isFirst      = true;

        BaseShip nearestTarget = null;

        BaseShip[] targets = FindObjectsOfType <BaseShip>();
        for (int i = 0; i < targets.Length; i++)
        {
            if (targets [i] != null)
            {
                if ((targets [i].isPlayerSide && !isOnPlayerSide) || (!targets [i].isPlayerSide && isOnPlayerSide))
                {
                    if (isFirst)
                    {
                        distance = (targets [i].transform.position - transform.position).magnitude;
                        isFirst  = false;
                    }

                    tempDistance = (targets [i].transform.position - transform.position).magnitude;
                    if (tempDistance <= distance && targets[i].shipClass == desiredClass)
                    {
                        distance      = tempDistance;
                        nearestTarget = targets [i];
                    }
                }
            }
        }
        if (targets.Length > 0 && nearestTarget != null)
        {
            wep.target = nearestTarget;
        }
    }
Example #5
0
    public override void OnBeatSuccess(BasePlanet planet, BeatResult result)
    {
        if (planet != this)
        {
            return;
        }

        int resultBonus =
            result == BeatResult.Awesome ? 3 : result == BeatResult.Good ? 2 : 1;

        if (planetState == PlanetState.Colonized && CanSpawnShip())
        {
            int units = defaultSpawnCount * resultBonus;
            Debug.LogFormat("Spawning {0} {1} units", units, shipPrefab.shipName);
            for (int i = 0; i < units; ++i)
            {
                BaseShip s = Instantiate <BaseShip>(shipPrefab);
                s.name = string.Format("{0}#{1}", s.shipName, counter++);
                s.SetHQ(hq);
                manager.SpendResourceList(shipSpawnRequirements);
                manager.RegisterShip(s);
            }
        }
        base.OnBeatSuccess(planet, result);
    }
Example #6
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            m_Ship = (BaseShip)reader.ReadItem();
        }
Example #7
0
 public void SetShip(BaseShip baseShip, BaseShip testBaseShip)
 {
     Ship                       = baseShip;
     testShip                   = testBaseShip;
     shipStatesData             = new ShipStateData[count];
     shipStatesData[0].shipData = baseShip.GetShipData();
 }
Example #8
0
        /// <summary>
        /// Set values to the horizontal and vertical start ship cells. Returns a value indicating whether setting the ship in field is successful.
        /// </summary>
        /// <param name="baseShip"></param>
        /// <param name="settedHorizontalStartCell"></param>
        /// <param name="settedVerticalStartCell"></param>
        /// <returns>bool</returns>
        public bool SetShip(BaseShip baseShip)
        {
            int settedHorizontalStartCell = baseShip.HorizontalCoordinateStartCell;
            int settedVerticalStartCell   = baseShip.VerticalCoordinateStartCell;

            if (this.IsPossibleToSetShip(baseShip))
            {
                if (baseShip.Direction == Direction.Horizontal)
                {
                    for (int i = 0; i < baseShip.Length; i++)
                    {
                        this.Cells[settedHorizontalStartCell + i, settedVerticalStartCell].CellType = baseShip.ShipType;
                    }
                }
                if (baseShip.Direction == Direction.Vertical)
                {
                    for (int i = 0; i < baseShip.Length; i++)
                    {
                        this.Cells[settedHorizontalStartCell, settedVerticalStartCell + i].CellType = baseShip.ShipType;
                    }
                }
                //baseShip.SetCoordinatesStartCell(settedHorizontalStartCell, settedVerticalStartCell);
                return(true);
            }
            return(false);
        }
Example #9
0
        public ShipScuttleGump(Mobile mobile, BaseShip ship) : base(110, 100)
        {
            m_Mobile = mobile;
            m_Ship   = ship;

            mobile.CloseGump(typeof(ShipScuttleGump));

            Closable = false;

            AddPage(0);

            AddBackground(0, 0, 420, 280, 5054);

            AddImageTiled(10, 10, 400, 20, 2624);
            AddAlphaRegion(10, 10, 400, 20);

            AddHtmlLocalized(10, 10, 400, 20, 1060635, 30720, false, false);               // <CENTER>WARNING</CENTER>

            AddImageTiled(10, 40, 400, 200, 2624);
            AddAlphaRegion(10, 40, 400, 200);

            AddHtml(10, 40, 400, 200, "You are about to scuttle this ship, sinking it and all creatures and items onboard. Once initiated, this action cannot be reversed. Are you sure you wish to proceed?", true, false);
            //AddHtmlLocalized( 10, 40, 400, 200, 1061795, 32512, false, true );

            AddImageTiled(10, 250, 400, 20, 2624);
            AddAlphaRegion(10, 250, 400, 20);

            AddButton(10, 250, 4005, 4007, 1, GumpButtonType.Reply, 0);
            AddHtmlLocalized(40, 250, 170, 20, 1011036, 32767, false, false);               // OKAY

            AddButton(210, 250, 4005, 4007, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(240, 250, 170, 20, 1011012, 32767, false, false);               // CANCEL
        }
Example #10
0
    // Add all explosion elements for the associated ship, and destroy the ship
    public void ExplodeShip(BaseShip Ship)
    {
        // Get ship pos
        Vector2 Pos = Ship.GetPosition();

        // Create destruction geometry / animation at the old ship position
        for(int j = 0; j < 32; j++)
        {
            float Radius = 45.0f;
            Vector2 Offset = new Vector2(UnityEngine.Random.Range(-Radius, Radius), UnityEngine.Random.Range(-Radius, Radius));
            Globals.WorldView.ProjManager.AddExplosion(Pos + Offset);
        }

        // Get the length of the ship
        float Facing = Ship.GetRotation();
        float Width = Ship.GetHullSprite().GetGeometrySize().x / 2.0f;
        float Height = Ship.GetHullSprite().GetGeometrySize().y / 2.0f;
        Vector2 ShipLength = new Vector2(Mathf.Cos(Facing), Mathf.Sin(Facing)) *  Width;
        Vector2 ShipSide = new Vector2(ShipLength.normalized.y, ShipLength.normalized.x);

        // For each chunk index
        int ChunkCount = Ship.GetChunkCount();
        for(int i = 0; i < ChunkCount * (Width / 20.0f); i++)
        {
            Vector2 Offset = ShipLength * UnityEngine.Random.Range(-1.0f, 1.0f) + ShipSide * UnityEngine.Random.Range(-Height, Height);
            float Rotation = UnityEngine.Random.Range(-Mathf.PI, Mathf.PI);
            Globals.WorldView.SceneManager.AddScenery(Ship.GetConfigFileName(), "Chunk" + (i % ChunkCount), new Vector3(Pos.x + Offset.x, Pos.y + Offset.y, 0), new Vector3(Offset.x / 100.0f, Offset.y / 100.0f, Rotation / 2.0f));
        }
    }
Example #11
0
 void Awake()
 {
     ship = GetComponent<BaseShip> ();
     ship.maxLife = 5;
     ship.damage = 10;
     ship.maxSpeed = 10;
 }
Example #12
0
        //public static Response CreateAccountRequestHandler(CreateAccountRequest arg)
        //{
        //    Console.WriteLine("User " + arg.username + " attempted to create account.");

        //    User currentUser = new User(arg.username, arg.password);
        //    currentUser.equippedShip = new Cruiser();
        //    currentUser.equippedShip.ownerID = currentUser.id;
        //    currentUser.equippedShip.shipType = "Cruiser";
        //    StarDatabaseCode.InsertShip(currentUser.equippedShip, currentUser);
        //    StarDatabaseCode.SetProgramIDOfShip(currentUser.equippedShip);

        public static Response CreateAccountRequestHandler(CreateAccountRequest arg)
        {
            Console.WriteLine("User " + arg.username + " attempted to create account.");

            User currentUser = new User(arg.username, arg.password);

            if (DatabaseFiles.DatabaseHandler.db.Query <User>($"SELECT * FROM users WHERE username='******'").ToList().Count > 0)
            {
                return(Response.From <User>(null));
            }
            else
            {
                currentUser.id = DatabaseFiles.DatabaseHandler.GetNumOfUsers() + 1;

                var startSystem = DatabaseFiles.DatabaseHandler.db.Query <StarSystem>("SELECT * FROM starsystems WHERE ID=1").ToList()[0];
                currentUser.position              = startSystem;
                currentUser.positionID            = startSystem.ID;
                currentUser.equippedShip          = new Cruiser();
                currentUser.equippedShip.shipType = "Cruiser";
                currentUser.equippedShip.ownerID  = currentUser.id;
                currentUser.equippedShip.id       = DatabaseFiles.DatabaseHandler.db.Query <BaseShip>("SELECT * FROM ships").ToList().Count() + 1;
                currentUser.equippedShipID        = currentUser.equippedShip.id;

                BaseShip shipToReplace = new BaseShip(currentUser.equippedShip);
                shipToReplace.ownerID = currentUser.id;
                //shipToReplace.shipType = "Cruiser";

                DatabaseFiles.DatabaseHandler.InsertShip(shipToReplace);
                currentUser.seshID = CreateSessionID(currentUser.username + DateTime.Today.ToString(), DateTime.Now);
                liveUsers.Add(currentUser.seshID, currentUser);
                DatabaseFiles.DatabaseHandler.InsertUser(currentUser);
                RequestListener.alerter.RegisterUser(currentUser);
                return(Response.From(currentUser));
            }
        }
Example #13
0
    /* Helper Methods here */


    // Get the nearest target
    void GetNearestTarget(bool isOnPlayerSide)
    {
        float       tempDistance  = 0;
        float       distance      = 0;
        bool        isFirst       = true;
        LargeShipAI nearestTarget = null;

        LargeShipAI[] targets = FindObjectsOfType <LargeShipAI>();
        for (int i = 0; i < targets.Length; i++)
        {
            if (targets [i] != null)
            {
                BaseShip targetBS = targets [i].GetComponent <BaseShip> ();
                if ((targetBS.isPlayerSide && !isOnPlayerSide) || (!targetBS.isPlayerSide && isOnPlayerSide))
                {
                    if (isFirst)
                    {
                        distance = (targets [i].transform.position - transform.position).magnitude;
                        isFirst  = false;
                    }

                    tempDistance = (targets [i].transform.position - transform.position).magnitude;
                    if (tempDistance <= distance)
                    {
                        distance      = tempDistance;
                        nearestTarget = targets [i];
                    }
                }
            }
        }
        if (targets.Length > 0 && nearestTarget != null)
        {
            target = nearestTarget.GetComponent <BaseShip>();
        }
    }
Example #14
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);
            int version = reader.ReadInt();

            //Version 0
            if (version >= 0)
            {
                m_ContestedPointsPerMinute  = reader.ReadDouble();
                m_ControlledPointsPerMinute = reader.ReadDouble();
                m_HotspotType = (HotspotEventType)reader.ReadInt();

                int participantsCount = reader.ReadInt();
                for (int a = 0; a < participantsCount; a++)
                {
                    BaseShip ship   = (BaseShip)reader.ReadItem();
                    int      points = reader.ReadInt();

                    OceanHotspotParticipantEntry entry = new OceanHotspotParticipantEntry(ship);
                    entry.m_Points = points;

                    m_Participants.Add(entry);
                }
            }

            //-----

            if (!m_Instances.Contains(this))
            {
                m_Instances.Add(this);
            }
        }
Example #15
0
 // Use this for initialization
 void Start()
 {
     mainController = FindObjectOfType <MainController>();
     bassShip       = FindObjectOfType <BaseShip>();
     bassShip.onJump.AddListener(Jump);
     bassShip.onFail.AddListener(Fail);
 }
        public static void GenerateShipDeckItems(BaseShip ship)
        {
            if (ship == null)
            {
                return;
            }
            if (ship.Deleted)
            {
                return;
            }

            int shipLevel = 1;

            if (ship is MediumShip || ship is MediumDragonShip)
            {
                shipLevel = 2;
            }
            if (ship is LargeShip || ship is LargeDragonShip)
            {
                shipLevel = 3;
            }
            if (ship is Carrack)
            {
                shipLevel = 4;
            }
            if (ship is Galleon)
            {
                shipLevel = 5;
            }

            int deckItems = 5 + (shipLevel * 3);
        }
Example #17
0
        /// <summary>
        /// Creates a new ship in this system.
        /// Note, changes are not submitted to database
        /// </summary>
        /// <param name="shipName">Name of the base ship model to use.</param>
        /// <returns>The newly create Ship object. (has already been added to the db.Insert queue)</returns>
        /// <exception cref="ArgumentException">Thrown when a Base Ship Model with the requested name is not found</exception>
        public virtual Ship CreateShip(string shipName)
        {
            CosmoMongerDbDataContext db = CosmoManager.GetDbContext();

            // Create a new ship
            Ship newShip = new Ship();

            // Assign the default base ship type
            BaseShip baseShip = (from bs in db.BaseShips
                                 where bs.Name == shipName
                                 select bs).SingleOrDefault();

            if (baseShip == null)
            {
                Logger.Write("Unable to load base ship from database", "Model", 1000, 0, TraceEventType.Critical);
                throw new ArgumentException("Unable to load base ship model from database", "shipName");
            }

            newShip.BaseShip    = baseShip;
            newShip.CosmoSystem = this;

            // Setup default upgrades
            newShip.JumpDrive = newShip.BaseShip.InitialJumpDrive;
            newShip.Shield    = newShip.BaseShip.InitialShield;
            newShip.Weapon    = newShip.BaseShip.InitialWeapon;

            db.Ships.InsertOnSubmit(newShip);

            return(newShip);
        }
        public bool IsDamaged(BaseShip ship, Mobile from, DamageType damageType)
        {
            switch (damageType)
            {
            case DamageType.Hull:
            {
                if (ship.HitPoints < ship.MaxHitPoints)
                {
                    return(true);
                }
                break;
            }

            case DamageType.Sails:
            {
                if (ship.SailPoints < ship.MaxSailPoints)
                {
                    return(true);
                }
                break;
            }

            case DamageType.Guns:
            {
                if (ship.GunPoints < ship.MaxGunPoints)
                {
                    return(true);
                }
                break;
            }
            }

            return(false);
        }
Example #19
0
 // Set the ship name and description info
 public void LoadDetails(BaseShip Ship)
 {
     ShipName = Ship.GetShipName();
     if(Ship is PlayerShip)
     {
         ShipType = "Command Ship";
         Description = "Name: Tevyat\nModel: 0X47-alpha\nDeveloper(s): NauTech Industries/ Tilus Mining Corps.\nClass: Industrial- Frigate\nThe Tevyat is a prototype starship under development between NauTech Industries and Tilus Mining Corps to support and sustain large-scale mining/construction operations within deep space.\nMost industrial starcrafts are unarmed, designed specifically for mining or cargo transportation. The Tevyat, however, was designed with enhanced defensive capabilities.  Tachyonic Barriers allow the ship to survive all methods of physical assault while nano-fabricators are capable of creating large offensive structures and drones.\nOther unique features include the Nautilus, a quantum artificial intelligence, functioning as the ship’s electronic warfare defense and navigation system.  When a fabricator builds a new object, the Nautilus “forks”, creating a smaller copy of itself that will execute asynchronously upon upload, making the Tevyat the intelligence core for all ships.";
     }
     else if(Ship is MinerShip)
     {
         ShipType = "Miner Ship";
         Description = "Class: Industrial transport\nModel: M3-2721 Scavenger\nDeveloper: Tilus Mining Corps.\nDesigned for efficient hauling and material extraction, mining ships are non-combative industrial starcrafts.  Though unarmed, these ships contain large cargo holds and are capable of fitting strip mining modules, heating components and magnetic rakes all on its medium sized hull.  Mining ships cannot refine or process materials; this is left to Shipyards.\nFirst assembled in 2215 by the South African extraction company Tilus Mining Corps, the Scavenger model’s design pays homage to the malfunctioning Jupiter probe responsible for the discovery of Element 115 in 2199.  Several hull designs exist but none are more durable, making it the most commonly used mining ship in the Sol System.";
     }
     else if(Ship is FighterShip)
     {
         ShipType = "Assault Ship";
         Description = "Class: Battlecrusier\nDeveloped: NauTech Industries/Core Software Solutions.\nModel:  Aurora Heavy Assault\nDesigned by NauTech Industries, the Aurora Heavy Assault model is lightly armored and extremely fast, well-suited for “hit and run” offensive strikes.  It has been optimized for reconnaissance and scouting, equipped with cutting-edge stealth technology  provided by Core Software Solutions.   It is unclear who originally commissioned the ship, however after the specs were stolen, the ship became common for military use.";
     }
     else if(Ship is DestroyerShip)
     {
         ShipType = "Destroyer Ship";
         Description = "Class: Industrial/Destroyer\nDeveloper: Haeshin Group\nModel: CTX- Nightshade\nOriginally created for urban development in the City of Seoul, the CTX-Nightshade induced an earthquake of catastrophic proportions while attempting to construct the world’s tallest building.  The craft, forever known as Destroyer, was re-engineered to fall between the Assault and Carrier class, possessing sturdy Tachyonc Barriers and advanced targeting arrays to add balance in combat.";
     }
     else if(Ship is CarrierShip)
     {
         ShipType = "Carrier Ship";
         Description = "Class: Carrier\nDeveloper: The North American Union (NAU)\nModel:  Dreadnought HMS-VI\nRepresenting the apex of NAU Military, Carriers are combat behemoths ranging between 750 meters to 1.5 kilometers in length. What Carriers lack in speed they make up for in devastating firepower.  With six Gatling guns, three slow-reload railguns and a drone bay launcher capable of deploying up to 25 high-speed fighter drones, these massive ships are invaluable to any fleet.\nLaunched to obtain NAU Mining Territory, the Dreadnought HMS-VI encountered the Juiz, a Destroyer under Brazilian Command.   As the groups began to fight, shots landed on Earth wiping out parts of South America and half of the US.  And so began the Great War.";
     }
     else
     {
         ShipType = Description = "UNDEFINED";
     }
 }
Example #20
0
        public void BuyPlayerShipAddedToSystem()
        {
            // Arrange
            SystemShip ship           = this.CreateSystemShip();
            BaseShip   playerBaseShip = new BaseShip();

            Mock <Ship> shipMock = new Mock <Ship>();

            // Setup player base ship model
            shipMock.Expect(s => s.BaseShip)
            .Returns(playerBaseShip).Verifiable();
            // Trade value is 5500
            shipMock.Expect(s => s.TradeInValue)
            .Returns(5500).Verifiable();
            // Cargo space is 50, with 25 free
            shipMock.Expect(s => s.CargoSpaceTotal)
            .Returns(50).Verifiable();
            shipMock.Expect(s => s.CargoSpaceFree)
            .Returns(25).Verifiable();
            // Cash on hand is 5000
            shipMock.Expect(s => s.Credits)
            .Returns(5000).Verifiable();

            // Act
            ship.Buy(shipMock.Object);

            // Assert
            shipMock.Verify();
            // Cost of the ship should be 2000 credits
            shipMock.VerifySet(m => m.Credits, 5000 - 2000);
            Assert.That(ship.Quantity, Is.EqualTo(0), "Should be no ships left in the system of this model");
            Assert.That(ship.CosmoSystem.SystemShips.Where(m => m.BaseShip == playerBaseShip && m.Quantity == 1), Is.Not.Empty, "The players base ship should have been added to the system for sale");
        }
Example #21
0
 protected BaseShipItem(BaseShip ship, int itemID, Point3D initOffset)
     : base(itemID)
 {
     Location = initOffset;
     Movable  = false;
     ship.Embark(this);
 }
Example #22
0
    private void CreateSpawnFX(BaseShip ship)
    {
        PoolObject fx = PoolManager.Get(POOL_TELEPORT_FX_ID);

        fx.transform.position = ship.transform.position;
        LeanTween.delayedCall(FLEET_SPAWN_ANIMATION_DELAY, ship.Activate);
    }
Example #23
0
    void OnCollisionEnter(Collision col)
    {
        BaseShip    bs = col.gameObject.GetComponent <BaseShip> ();
        Destroyable ds = col.gameObject.GetComponent <Destroyable> ();

        if (bs == whoFiredMe)
        {
            return;
        }
        if (bs != null)
        {
            if (col.collider.CompareTag("Turret"))
            {
                TurretAI ta = col.collider.GetComponent <TurretAI> ();
                if (ta != null)
                {
                    ta.Damage(damage, whoFiredMe);
                }
            }
            else if (col.collider.CompareTag("Weak"))
            {
                bs.Damage(damage * 2, whoFiredMe);
            }
            else
            {
                bs.Damage(damage, whoFiredMe);
            }
        }
        else if (ds != null)
        {
            ds.Damage(damage);
        }
    }
Example #24
0
        /// <summary>
        /// Create the ship for the NPC
        /// </summary>
        public override void Setup()
        {
            base.Setup();

            CosmoMongerDbDataContext db = CosmoManager.GetDbContext();

            // Select a random race
            Race npcRace = this.rnd.SelectOne(db.Races);

            // Assign the race
            this.npcRow.Race = npcRace;

            // We only start in systems with the same race
            IQueryable <CosmoSystem> possibleStartingSystems = (from s in db.CosmoSystems
                                                                where s.Race == npcRace
                                                                select s);
            CosmoSystem startingSystem = this.rnd.SelectOne(possibleStartingSystems);

            // Randomly select a base ship model
            BaseShip startingShipModel = this.rnd.SelectOne(db.BaseShips);

            // Create the NPC ship
            Ship npcShip = startingSystem.CreateShip(startingShipModel.Name);

            this.npcRow.Ship = npcShip;

            // Randomly assign upgrades
            npcShip.JumpDrive = this.rnd.SelectOne(db.JumpDrives);
            npcShip.Shield    = this.rnd.SelectOne(db.Shields);
            npcShip.Weapon    = this.rnd.SelectOne(db.Weapons);

            // Set the next travel time to now
            this.npcRow.NextTravelTime = DateTime.UtcNow;
        }
Example #25
0
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            int version = reader.ReadInt();

            switch (version)
            {
            case 0:
            {
                m_Ship     = reader.ReadItem() as BaseShip;
                m_Side     = (PlankSide)reader.ReadInt();
                m_Locked   = reader.ReadBool();
                m_KeyValue = reader.ReadUInt();

                if (m_Ship == null)
                {
                    Delete();
                }

                break;
            }
            }

            if (IsOpen)
            {
                m_CloseTimer = new CloseTimer(this);
                m_CloseTimer.Start();
            }
        }
Example #26
0
        public MaintenanceBay(BaseShip ship, System.Guid teamId)
            : base(ship, "Maintenance Bay", 0, 3, new System.Guid(), teamId)
        {
            ActionModel HealModel = ActionManager.instance.GetActionModel(healID, 0);

            heal = new Heal(HealModel, healID, ship.GetSelfId(), ship.GetTeamId());
            heal.readyAction();
        }
Example #27
0
        static void Main(string[] args)
        {
            BaseShip ship = GetShip(ShipType.FightShip);
            string   res  = ship.Fight();

            Console.WriteLine(res);
            Console.ReadKey();
        }
Example #28
0
        public WeaponsBay(BaseShip ship, Guid teamId)
            : base(ship, "Weapons Bay", 0, 3, new System.Guid(), teamId)
        {
            ActionModel lasCanModel = ActionManager.instance.GetActionModel(lasCannonID, 0);

            lasCannon = new LasCannon(lasCanModel, lasCannonID, ship.GetSelfId(), ship.GetTeamId());
            lasCannon.readyAction();
        }
    public void ReplaceBaseShipStats(BaseShip newBaseShip)
    {
        var index     = GameComponentsLookup.BaseShipStats;
        var component = CreateComponent <BaseShipStats>(index);

        component.baseShip = newBaseShip;
        ReplaceComponent(index, component);
    }
Example #30
0
 public BaseRoom(BaseShip ship, string roomName, int currentCrewCount, int maxCrewCount, Guid SelfId, Guid TeamId)
 {
     RoomName    = roomName;
     roomMaxCrew = maxCrewCount;
     CrewCount   = currentCrewCount;
     this.ship   = ship;
     ship.addRoom(this);
 }
Example #31
0
 protected override void DoAction(int roundNum, IEnumerable <ITargetable> targets)
 {
     if (ActionUsable)
     {
         BaseShip playerShip = (BaseShip)AvailableTargets().FirstOrDefault();
         playerShip.AllocateCrew(1);
     }
 }
Example #32
0
 void Awake()
 {
     ship = GetComponent<BaseShip> ();
     ship.maxLife = 50;
     ship.damage = 5;
     ship.maxSpeed = 1;
     GetComponent<AudioSource> ().volume = 0.01f * Global.stat.SoundModifier;
 }
Example #33
0
        public NavigationRoom(BaseShip ship, System.Guid teamId)
            : base(ship, "Navigation Room", 0, 3, new System.Guid(), teamId)
        {
            ActionModel BaseNavModel = ActionManager.instance.GetActionModel(baseNavID, 0);

            baseNave = new BaseNav(BaseNavModel, baseNavID, ship.GetSelfId(), ship.GetTeamId());
            baseNave.readyAction();
        }
Example #34
0
        public ResearchCenter(BaseShip ship, System.Guid teamId)
            : base(ship, "Research Center", 0, 3, new System.Guid(), teamId)
        {
            ActionModel repModel = ActionManager.instance.GetActionModel(g, 0);

            rep = new Replication(repModel, g, ship.GetSelfId(), ship.GetTeamId());
            rep.readyAction();
        }
Example #35
0
        public ShieldBay(BaseShip ship, System.Guid teamId)
            : base(ship, "Shield Bay", 0, 3, new Guid(), teamId)
        {
            ActionModel ShieldModel = ActionManager.instance.GetActionModel(ShieldID, 0);

            baseShield = new Shield(ShieldModel, ShieldID, ship.GetSelfId(), ship.GetTeamId());
            baseShield.readyAction();
        }
Example #36
0
 public void Start()
 {
     myShip = this.GetComponentInParent((typeof(BaseShip))) as BaseShip;
     fullShield = myShip.getShields();
     if (fullShield == 0)
     {
         transform.localScale = new Vector3(0, 1, 1);
     }
 }
Example #37
0
 void Awake()
 {
     ship = GetComponent<BaseShip> ();
     ship.maxLife = 10;
     ship.damage = 5;
     ship.maxSpeed = 3;
     currentBarrel = 0;
     if (gameObject.tag.Contains ("Blue")) {
         team = "Blue";
     } else if (gameObject.tag.Contains ("Red")) {
         team = "Red";
     }
 }
Example #38
0
        public BoatListGump(List<Mobile> list, BaseShip ship, bool accountOf) : base(20, 30)
        {
            if (ship.Deleted)
                return;

            m_Ship = ship;

            AddPage(0);

            AddBackground(0, 0, 420, 430, 5054);
            AddBackground(10, 10, 400, 410, 3000);

            AddButton(20, 388, 4005, 4007, 0, GumpButtonType.Reply, 0);
            AddHtmlLocalized(55, 388, 300, 20, 1011104, false, false); // Return to previous menu

            AddLabel(20, 20, 0, "Officers of the Ship");

            if (list != null)
            {
                for (int i = 0; i < list.Count; ++i)
                {
                    if ((i % 16) == 0)
                    {
                        if (i != 0)
                        {
                            // Next button
                            AddButton(370, 20, 4005, 4007, 0, GumpButtonType.Page, (i / 16) + 1);
                        }

                        AddPage((i / 16) + 1);

                        if (i != 0)
                        {
                            // Previous button
                            AddButton(340, 20, 4014, 4016, 0, GumpButtonType.Page, i / 16);
                        }
                    }

                    Mobile m = list[i];

                    string name;

                    if (m == null || (name = m.Name) == null || (name = name.Trim()).Length <= 0)
                        continue;

                    AddLabel(55, 55 + ((i % 16) * 20), 0,
                        accountOf && m.Player && m.Account != null ? String.Format("Account of {0}", name) : name);
                }
            }
        }
		public SecuritySettingsGump(SecuritySettingsGumpPage page, Mobile from, BaseShip ship, Dictionary<int, PlayerMobile> playersAboard, int currentAccessListPage, PlayerMobile selectedPlayer) 
			: base(50, 40)		
		{
            m_Ship = ship;
			m_Page = page;
			m_PlayersAboard = playersAboard;
			m_CurrentAccessListPage = currentAccessListPage;
			m_SelectedPlayer = selectedPlayer;

            from.CloseGump(typeof(SecuritySettingsGump));

			bool isOwner = false;
			if (from == ship.Owner)
				isOwner = true;
			
			if (!isOwner)
			{
				if (m_Ship.CanModifySecurity == 0)
					return;
				else if (m_Ship.CanModifySecurity == 1)
					if (from.Party != m_Ship.Owner.Party)
						return;
					else if (((Party)(m_Ship.Owner.Party)).Leader != m_Ship.Owner)
							return;
				else if (m_Ship.CanModifySecurity == 2)
					if (from.Party != m_Ship.Owner.Party)
						return;
			}
			
			this.AddPage(0);	
				
			this.AddImageTiled(0, 0, 20, 18, 0xA3C);
			this.AddImageTiled(20, 0, 270, 18, 0xA3D);
			this.AddImageTiled(286, 0, 20, 18, 0xA3E);
			this.AddImageTiled(0, 18, 22, 210, 0xA3F);
			this.AddImageTiled(20, 18, 266, 206, 0xA40);
			this.AddImageTiled(286, 18, 20, 210, 0xA41);
			this.AddImageTiled(0, 224, 22, 210, 0xA3F);
			this.AddImageTiled(20, 224, 266, 206, 0xA40);
			this.AddImageTiled(286, 224, 20, 210, 0xA41);
			this.AddImageTiled(0, 430, 20, 18, 0xA42);
			this.AddImageTiled(20, 430, 270, 18, 0xA43);
			this.AddImageTiled(286, 430, 20, 18, 0xA44);
			
			this.AddLabel(85, 20, 53, "Passenger and Crew Manifest");
			this.AddLabel(10, 50, LabelHue, String.Format("Ship: {0}", (m_Ship.ShipName != null)?m_Ship.ShipName:"unnamed ship"));
			this.AddLabel(10, 70, LabelHue, String.Format("Owner: {0}", m_Ship.Owner.Name));

			if ((page == SecuritySettingsGumpPage.Default) || (page == SecuritySettingsGumpPage.Public) || (page == SecuritySettingsGumpPage.Party) || (page == SecuritySettingsGumpPage.Guild))
			{
			
			
				this.AddLabel(10, 100, LabelHue, String.Format("Party membership modifies access to this ship: "));

				
				switch (m_Ship.CanModifySecurity)
				{
					case (0):
						{
							this.AddButton(60, 120, 0xFA6, 0xFA6, this.GetButtonID(0, 0), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 120, 240, 20, 1149778, LabelColor, false, false);// Never
							this.AddButton(60, 140, 0xFA5, 0xFA6, this.GetButtonID(0, 1), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 140, 240, 20, 1149744, LabelColor, false, false);// When I am a Party Leader
							this.AddButton(60, 160, 0xFA5, 0xFA6, this.GetButtonID(0, 2), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 160, 240, 20, 1149745, LabelColor, false, false);// When I am a Party Member
								
							break;					
						}
						
					case (1):
						{
							this.AddButton(60, 120, 0xFA5, 0xFA6, this.GetButtonID(0, 0), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 120, 240, 20, 1149778, LabelColor, false, false);// Never
							this.AddButton(60, 140, 0xFA6, 0xFA6, this.GetButtonID(0, 1), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 140, 240, 20, 1149744, LabelColor, false, false);// When I am a Party Leader
							this.AddButton(60, 160, 0xFA5, 0xFA6, this.GetButtonID(0, 2), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 160, 240, 20, 1149745, LabelColor, false, false);// When I am a Party Member
								
							break;
						}
						
					case (2):
						{
							this.AddButton(60, 120, 0xFA5, 0xFA6, this.GetButtonID(0, 0), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 120, 240, 20, 1149778, LabelColor, false, false);// Never
							this.AddButton(60, 140, 0xFA5, 0xFA6, this.GetButtonID(0, 1), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 140, 240, 20, 1149744, LabelColor, false, false);// When I am a Party Leader
							this.AddButton(60, 160, 0xFA6, 0xFA6, this.GetButtonID(0, 2), GumpButtonType.Reply, 0); 
							this.AddHtmlLocalized(95, 160, 240, 20, 1149745, LabelColor, false, false);// When I am a Party Member

							break;
						}
				}	

				this.AddLabel(10, 180, LabelHue, String.Format("Public Access: "));			
				
				if (page == SecuritySettingsGumpPage.Public)
					this.AddButton(120, 180, 0xFA6, 0xFA6, this.GetButtonID(1, 0), GumpButtonType.Reply, 0);
				else
					this.AddButton(120, 180, 0xFA5, 0xFA6, this.GetButtonID(1, 0), GumpButtonType.Reply, 0);
				
				switch (m_Ship.Public)
				{
					case (0):
						{
							this.AddLabel(155, 180, 906, String.Format("N/A"));
								
							break;					
						}
						
					case (1):
						{
							this.AddLabel(155, 180, 98, String.Format("PASSENGER"));
								
							break;
						}
						
					case (2):
						{
							this.AddLabel(155, 180, 68, String.Format("CREW"));

							break;
						}
						
					case (3):
						{
							this.AddLabel(155, 180, 53, String.Format("OFFICER"));

							break;
						}
		
					case (4):
						{
							this.AddLabel(155, 180, 906, String.Format("CAPTAIN"));

							break;
						}
						
					case (5):
						{
							this.AddLabel(155, 180, 38, String.Format("DENY ACCESS"));

							break;
						}
				}
				
				this.AddLabel(10, 200, LabelHue, String.Format("Party Access: "));		

				if (page == SecuritySettingsGumpPage.Party)
					this.AddButton(120, 200, 0xFA6, 0xFA6, this.GetButtonID(1, 1), GumpButtonType.Reply, 0);
				else
					this.AddButton(120, 200, 0xFA5, 0xFA6, this.GetButtonID(1, 1), GumpButtonType.Reply, 0);			
				
				switch (m_Ship.Party)
				{
					case (0):
						{
							this.AddLabel(155, 200, 906, String.Format("N/A"));
								
							break;					
						}
						
					case (1):
						{
							this.AddLabel(155, 200, 98, String.Format("PASSENGER"));
								
							break;
						}
						
					case (2):
						{
							this.AddLabel(155, 200, 68, String.Format("CREW"));

							break;
						}
						
					case (3):
						{
							this.AddLabel(155, 200, 53, String.Format("OFFICER"));

							break;
						}
		
					case (4):
						{
							this.AddLabel(155, 200, 906, String.Format("CAPTAIN"));

							break;
						}
						
					case (5):
						{
							this.AddLabel(155, 200, 38, String.Format("DENY ACCESS"));

							break;
						}
				}
							
				this.AddLabel(10, 220, LabelHue, String.Format("Guild Access: "));

				if (page == SecuritySettingsGumpPage.Guild)
					this.AddButton(120, 220, 0xFA6, 0xFA6, this.GetButtonID(1, 2), GumpButtonType.Reply, 0); 
				else
					this.AddButton(120, 220, 0xFA5, 0xFA6, this.GetButtonID(1, 2), GumpButtonType.Reply, 0); 
					
				switch (m_Ship.Guild)
				{
					case (0):
						{
							this.AddLabel(155, 220, 906, String.Format("N/A"));
								
							break;					
						}
						
					case (1):
						{
							this.AddLabel(155, 220, 98, String.Format("PASSENGER"));
								
							break;
						}
						
					case (2):
						{
							this.AddLabel(155, 220, 68, String.Format("CREW"));

							break;
						}
						
					case (3):
						{
							this.AddLabel(155, 220, 53, String.Format("OFFICER"));

							break;
						}
		
					case (4):
						{
							this.AddLabel(155, 220, 906, String.Format("CAPTAIN"));

							break;
						}
						
					case (5):
						{
							this.AddLabel(155, 220, 38, String.Format("DENY ACCESS"));

							break;
						}
				}			
				
				switch ( page )
				{	
					case SecuritySettingsGumpPage.Public:
						{	
							switch (m_Ship.Public)
							{
								case (0):
									{
										this.AddLabel(20, 260, LabelHue, String.Format("Public Access: "));
										this.AddButton(20, 280, 0xFA6, 0xFA6, this.GetButtonID(2, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 280, LabelHue, "N/A");
										this.AddButton(20, 300, 0xFA5, 0xFA6, this.GetButtonID(2, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 300, LabelHue, "PASSENGER");
										this.AddButton(20, 320, 0xFA5, 0xFA6, this.GetButtonID(2, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 320, LabelHue, "CREW");
										this.AddButton(20, 340, 0xFA5, 0xFA6, this.GetButtonID(2, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 340, LabelHue, "OFFICER");
										this.AddButton(20, 360, 0xFA5, 0xFA6, this.GetButtonID(2, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 360, LabelHue, "DENY ACCESS");
											
										break;					
									}
									
								case (1):
									{
										this.AddLabel(20, 260, LabelHue, String.Format("Public Access: "));
										this.AddButton(20, 280, 0xFA5, 0xFA6, this.GetButtonID(2, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 280, LabelHue, "N/A");
										this.AddButton(20, 300, 0xFA6, 0xFA6, this.GetButtonID(2, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 300, 98, "PASSENGER");
										this.AddButton(20, 320, 0xFA5, 0xFA6, this.GetButtonID(2, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 320, LabelHue, "CREW");
										this.AddButton(20, 340, 0xFA5, 0xFA6, this.GetButtonID(2, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 340, LabelHue, "OFFICER");
										this.AddButton(20, 360, 0xFA5, 0xFA6, this.GetButtonID(2, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 360, LabelHue, "DENY ACCESS");
											
										break;
									}
									
								case (2):
									{
										this.AddLabel(20, 260, LabelHue, String.Format("Public Access: "));
										this.AddButton(20, 280, 0xFA5, 0xFA6, this.GetButtonID(2, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 280, LabelHue, "N/A");
										this.AddButton(20, 300, 0xFA5, 0xFA6, this.GetButtonID(2, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 300, LabelHue, "PASSENGER");
										this.AddButton(20, 320, 0xFA6, 0xFA6, this.GetButtonID(2, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 320, 68, "CREW");
										this.AddButton(20, 340, 0xFA5, 0xFA6, this.GetButtonID(2, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 340, LabelHue, "OFFICER");
										this.AddButton(20, 360, 0xFA5, 0xFA6, this.GetButtonID(2, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 360, LabelHue, "DENY ACCESS");

										break;
									}
									
								case (3):
									{
										this.AddLabel(20, 260, LabelHue, String.Format("Public Access: "));
										this.AddButton(20, 280, 0xFA5, 0xFA6, this.GetButtonID(2, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 280, LabelHue, "N/A");
										this.AddButton(20, 300, 0xFA5, 0xFA6, this.GetButtonID(2, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 300, LabelHue, "PASSENGER");
										this.AddButton(20, 320, 0xFA5, 0xFA6, this.GetButtonID(2, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 320, LabelHue, "CREW");
										this.AddButton(20, 340, 0xFA6, 0xFA6, this.GetButtonID(2, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 340, 53, "OFFICER");
										this.AddButton(20, 360, 0xFA5, 0xFA6, this.GetButtonID(2, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 360, LabelHue, "DENY ACCESS");

										break;
									}
					
								case (4):
									{
										this.AddLabel(20, 260, LabelHue, String.Format("Public Access: "));
										this.AddButton(20, 280, 0xFA5, 0xFA6, this.GetButtonID(2, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 280, LabelHue, "N/A");
										this.AddButton(20, 300, 0xFA5, 0xFA6, this.GetButtonID(2, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 300, LabelHue, "PASSENGER");
										this.AddButton(20, 320, 0xFA5, 0xFA6, this.GetButtonID(2, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 320, LabelHue, "CREW");
										this.AddButton(20, 340, 0xFA5, 0xFA6, this.GetButtonID(2, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 340, LabelHue, "OFFICER");
										this.AddButton(20, 360, 0xFA5, 0xFA6, this.GetButtonID(2, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 360, LabelHue, "DENY ACCESS");

										break;
									}
									
								case (5):
									{
										this.AddLabel(20, 260, LabelHue, String.Format("Public Access: "));
										this.AddButton(20, 280, 0xFA5, 0xFA6, this.GetButtonID(2, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 280, LabelHue, "N/A");
										this.AddButton(20, 300, 0xFA5, 0xFA6, this.GetButtonID(2, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 300, LabelHue, "PASSENGER");
										this.AddButton(20, 320, 0xFA5, 0xFA6, this.GetButtonID(2, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 320, LabelHue, "CREW");
										this.AddButton(20, 340, 0xFA5, 0xFA6, this.GetButtonID(2, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 340, LabelHue, "OFFICER");
										this.AddButton(20, 360, 0xFA6, 0xFA6, this.GetButtonID(2, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(55, 360, 38, "DENY ACCESS");

										break;
									}
							}																																
							break;
						}									
						
					case SecuritySettingsGumpPage.Party:
						{

							switch (m_Ship.Party)
							{
								case (0):
									{
										this.AddLabel(80, 260, LabelHue, String.Format("Party Access: "));
										this.AddButton(80, 280, 0xFA6, 0xFA6, this.GetButtonID(3, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(3, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(3, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(3, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(3, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "DENY ACCESS");

											
										break;					
									}
									
								case (1):
									{
										this.AddLabel(80, 260, LabelHue, String.Format("Party Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(3, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA6, 0xFA6, this.GetButtonID(3, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, 98, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(3, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(3, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(3, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "DENY ACCESS");

											
										break;
									}
									
								case (2):
									{
										this.AddLabel(80, 260, LabelHue, String.Format("Party Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(3, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(3, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA6, 0xFA6, this.GetButtonID(3, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, 68, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(3, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(3, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "DENY ACCESS");


										break;
									}
									
								case (3):
									{
										this.AddLabel(80, 260, LabelHue, String.Format("Party Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(3, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(3, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(3, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA6, 0xFA6, this.GetButtonID(3, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, 53, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(3, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "DENY ACCESS");


										break;
									}
					
								case (4):
									{
										this.AddLabel(80, 260, LabelHue, String.Format("Party Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(3, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(3, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(3, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(3, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(3, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "DENY ACCESS");


										break;
									}
									
								case (5):
									{
										this.AddLabel(80, 260, LabelHue, String.Format("Party Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(3, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(3, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(3, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(3, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA6, 0xFA6, this.GetButtonID(3, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, 38, "DENY ACCESS");

										break;
									}
							}										
							break;
						}
						
					case SecuritySettingsGumpPage.Guild:
						{
							switch (m_Ship.Guild)
							{
								case (0):
									{
										this.AddLabel(140, 260, LabelHue, String.Format("Guild Access: "));
										this.AddButton(140, 280, 0xFA6, 0xFA6, this.GetButtonID(4, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 280, LabelHue, "N/A");
										this.AddButton(140, 300, 0xFA5, 0xFA6, this.GetButtonID(4, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 300, LabelHue, "PASSENGER");
										this.AddButton(140, 320, 0xFA5, 0xFA6, this.GetButtonID(4, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 320, LabelHue, "CREW");
										this.AddButton(140, 340, 0xFA5, 0xFA6, this.GetButtonID(4, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 340, LabelHue, "OFFICER");
										this.AddButton(140, 360, 0xFA5, 0xFA6, this.GetButtonID(4, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 360, LabelHue, "DENY ACCESS");
											
										break;					
									}
									
								case (1):
									{
										this.AddLabel(140, 260, LabelHue, String.Format("Guild Access: "));
										this.AddButton(140, 280, 0xFA5, 0xFA6, this.GetButtonID(4, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 280, LabelHue, "N/A");
										this.AddButton(140, 300, 0xFA6, 0xFA6, this.GetButtonID(4, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 300, 98, "PASSENGER");
										this.AddButton(140, 320, 0xFA5, 0xFA6, this.GetButtonID(4, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 320, LabelHue, "CREW");
										this.AddButton(140, 340, 0xFA5, 0xFA6, this.GetButtonID(4, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 340, LabelHue, "OFFICER");
										this.AddButton(140, 360, 0xFA5, 0xFA6, this.GetButtonID(4, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 360, LabelHue, "DENY ACCESS");

										break;
									}
									
								case (2):
									{
										this.AddLabel(140, 260, LabelHue, String.Format("Guild Access: "));
										this.AddButton(140, 280, 0xFA5, 0xFA6, this.GetButtonID(4, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 280, LabelHue, "N/A");
										this.AddButton(140, 300, 0xFA5, 0xFA6, this.GetButtonID(4, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 300, LabelHue, "PASSENGER");
										this.AddButton(140, 320, 0xFA6, 0xFA6, this.GetButtonID(4, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 320, 68, "CREW");
										this.AddButton(140, 340, 0xFA5, 0xFA6, this.GetButtonID(4, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 340, LabelHue, "OFFICER");
										this.AddButton(140, 360, 0xFA5, 0xFA6, this.GetButtonID(4, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 360, LabelHue, "DENY ACCESS");

										break;
									}
									
								case (3):
									{
										this.AddLabel(140, 260, LabelHue, String.Format("Guild Access: "));
										this.AddButton(140, 280, 0xFA5, 0xFA6, this.GetButtonID(4, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 280, LabelHue, "N/A");
										this.AddButton(140, 300, 0xFA5, 0xFA6, this.GetButtonID(4, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 300, LabelHue, "PASSENGER");
										this.AddButton(140, 320, 0xFA5, 0xFA6, this.GetButtonID(4, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 320, LabelHue, "CREW");
										this.AddButton(140, 340, 0xFA6, 0xFA6, this.GetButtonID(4, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 340, 53, "OFFICER");
										this.AddButton(140, 360, 0xFA5, 0xFA6, this.GetButtonID(4, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 360, LabelHue, "DENY ACCESS");

										break;
									}
					
								case (4):
									{
										this.AddLabel(140, 260, LabelHue, String.Format("Guild Access: "));
										this.AddButton(140, 280, 0xFA5, 0xFA6, this.GetButtonID(4, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 280, LabelHue, "N/A");
										this.AddButton(140, 300, 0xFA5, 0xFA6, this.GetButtonID(4, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 300, LabelHue, "PASSENGER");
										this.AddButton(140, 320, 0xFA5, 0xFA6, this.GetButtonID(4, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 320, LabelHue, "CREW");
										this.AddButton(140, 340, 0xFA5, 0xFA6, this.GetButtonID(4, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 340, LabelHue, "OFFICER");
										this.AddButton(140, 360, 0xFA5, 0xFA6, this.GetButtonID(4, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 360, LabelHue, "DENY ACCESS");

										break;
									}
									
								case (5):
									{
										this.AddLabel(140, 260, LabelHue, String.Format("Guild Access: "));
										this.AddButton(140, 280, 0xFA5, 0xFA6, this.GetButtonID(4, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 280, LabelHue, "N/A");
										this.AddButton(140, 300, 0xFA5, 0xFA6, this.GetButtonID(4, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 300, LabelHue, "PASSENGER");
										this.AddButton(140, 320, 0xFA5, 0xFA6, this.GetButtonID(4, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 320, LabelHue, "CREW");
										this.AddButton(140, 340, 0xFA5, 0xFA6, this.GetButtonID(4, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 340, LabelHue, "OFFICER");
										this.AddButton(140, 360, 0xFA6, 0xFA6, this.GetButtonID(4, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(175, 360, 38, "DENY ACCESS");

										break;
									}
							}		

						

							
							break;
						}					
				}
				
				this.AddButtonLabeled(160, 410, this.GetButtonID(6, 1), 1149734); // Access List
				
			}
			else
			{
				switch( page )
				{
					case (SecuritySettingsGumpPage.AccessListDefault):
						{
						
							if (playersAboard == null)
								break;
								
							int PlayersCounter = playersAboard.Count;				

							int currentPage = 1;
							int currentLine = 0;
							int currentButton = 0;
							
							this.AddPage(1);
							
							foreach(KeyValuePair<int, PlayerMobile> entry in playersAboard)
							{
																
								this.AddButton(10, 100 + currentLine * 20, 0xFA5, 0xFA6, this.GetButtonID(5, currentButton++), GumpButtonType.Reply, 0);
								this.AddLabel(45, 100 + currentLine * 20, LabelHue, (entry.Value).Name);
								
								byte listedPlayerAccess = 0;
								if (m_Ship.PlayerAccess != null)
									foreach(KeyValuePair<PlayerMobile, byte> entry2 in m_Ship.PlayerAccess)							
										if (entry.Value == entry2.Key)
											listedPlayerAccess = entry2.Value;								

								switch (listedPlayerAccess)
								{
									case (0):
										{
											this.AddLabel(120, 100 + currentLine * 20, LabelHue, "N/A");
												
											break;					
										}
										
									case (1):
										{
											this.AddLabel(120, 100 + currentLine * 20, 98, "PASSENGER");
												
											break;					
										}
									
									case (2):
										{
											this.AddLabel(120, 100 + currentLine * 20, 68, "CREW");
												
											break;					
										}
										
									case (3):
										{
											this.AddLabel(120, 100 + currentLine * 20, 53, "OFFICER");
												
											break;					
										}
										
									case (4):
										{
											this.AddLabel(120, 100 + currentLine * 20, 43, "CAPTAIN");
												
											break;					
										}
										
									case (5):
										{
											this.AddLabel(120, 100 + currentLine * 20, 38, "DENY ACCESS");
												
											break;					
										}
								}
								
								++currentLine;
								
								if (currentLine == 10)
								{
									currentLine = 0;
									currentButton = 0;
									this.AddPage(currentPage++);
									
									m_CurrentAccessListPage = currentPage;																		
								}
								
								if (currentPage > m_CurrentAccessListPage)
									break;
							}
							
							this.AddButton(10, 410, 0xFA5, 0xFA6, this.GetButtonID(6, 0), GumpButtonType.Reply, 0);
							this.AddLabel(45, 410, LabelHue, "MAIN MENU");	
							
							if (m_CurrentAccessListPage > 1)							
								this.AddButton(160, 410, 0xFAE, 0xFAF,this.GetButtonID(6, 2), GumpButtonType.Reply, 0);
							
							
							if (currentLine == 0) 
								this.AddButton(200, 410, 0xFA5, 0xFA6,this.GetButtonID(6, 3), GumpButtonType.Reply, 0);
								
							
						}	

						break;					
						
					case (SecuritySettingsGumpPage.AccessListPlayer):
						{
						
							if (selectedPlayer == null)
								break;

							this.AddLabel(10, 120, LabelHue, selectedPlayer.Name);
								
							byte selectedPlayerAccess = 0;
							if (m_Ship.PlayerAccess != null)
								foreach(KeyValuePair<PlayerMobile, byte> entry in m_Ship.PlayerAccess)							
									if (selectedPlayer == entry.Key)
										selectedPlayerAccess = entry.Value;								

							switch (selectedPlayerAccess)
							{
								case (0):
									{
										this.AddLabel(80, 120, LabelHue, "N/A");
										this.AddLabel(80, 260, LabelHue, String.Format(selectedPlayer.Name + " Access: "));
										this.AddButton(80, 280, 0xFA6, 0xFA6, this.GetButtonID(7, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(7, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(7, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(7, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(7, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "CAPTAIN");
										this.AddButton(80, 380, 0xFA5, 0xFA6, this.GetButtonID(7, 5), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 380, LabelHue, "DENY ACCESS");

											
										break;					
									}
									
								case (1):
									{
										this.AddLabel(80, 120, 98, "PASSENGER");
										this.AddLabel(80, 260, LabelHue, String.Format(selectedPlayer.Name + " Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(7, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA6, 0xFA6, this.GetButtonID(7, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, 98, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(7, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(7, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(7, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "CAPTAIN");
										this.AddButton(80, 380, 0xFA5, 0xFA6, this.GetButtonID(7, 5), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 380, LabelHue, "DENY ACCESS");

											
										break;
									}
									
								case (2):
									{
										this.AddLabel(80, 120, 68, "CREW");
										this.AddLabel(80, 260, LabelHue, String.Format(selectedPlayer.Name + " Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(7, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(7, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA6, 0xFA6, this.GetButtonID(7, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, 68, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(7, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(7, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "CAPTAIN");
										this.AddButton(80, 380, 0xFA5, 0xFA6, this.GetButtonID(7, 5), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 380, LabelHue, "DENY ACCESS");


										break;
									}
									
								case (3):
									{
										this.AddLabel(80, 120, 53, "OFFICER");
										this.AddLabel(80, 260, LabelHue, String.Format(selectedPlayer.Name + " Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(7, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(7, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(7, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA6, 0xFA6, this.GetButtonID(7, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, 53, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(7, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "CAPTAIN");
										this.AddButton(80, 380, 0xFA5, 0xFA6, this.GetButtonID(7, 5), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 380, LabelHue, "DENY ACCESS");


										break;
									}
					
								case (4):
									{
										this.AddLabel(80, 120, 43, "CAPTAIN");
										this.AddLabel(80, 260, LabelHue, String.Format(selectedPlayer.Name + " Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(7, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(7, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(7, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(7, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA5, 0xFA6, this.GetButtonID(7, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, 43, "CAPTAIN");
										this.AddButton(80, 380, 0xFA5, 0xFA6, this.GetButtonID(7, 5), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 380, LabelHue, "DENY ACCESS");


										break;
									}
									
								case (5):
									{
										this.AddLabel(80, 120, 38, "DENY ACCESS");
										this.AddLabel(80, 260, LabelHue, String.Format(selectedPlayer.Name + " Access: "));
										this.AddButton(80, 280, 0xFA5, 0xFA6, this.GetButtonID(7, 0), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 280, LabelHue, "N/A");
										this.AddButton(80, 300, 0xFA5, 0xFA6, this.GetButtonID(7, 1), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 300, LabelHue, "PASSENGER");
										this.AddButton(80, 320, 0xFA5, 0xFA6, this.GetButtonID(7, 2), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 320, LabelHue, "CREW");
										this.AddButton(80, 340, 0xFA5, 0xFA6, this.GetButtonID(7, 3), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 340, LabelHue, "OFFICER");
										this.AddButton(80, 360, 0xFA6, 0xFA6, this.GetButtonID(7, 4), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 360, LabelHue, "CAPTAIN");
										this.AddButton(80, 380, 0xFA5, 0xFA6, this.GetButtonID(7, 5), GumpButtonType.Reply, 0); 
										this.AddLabel(115, 380, 38, "DENY ACCESS");

										break;
									}
							}											
						}
						
						break;						
				}
			}														
        }
Example #40
0
    // Update is called once per frame
    void Update()
    {
        // If not yet loaded, it should be good to go..
        if(!LevelLoaded)
            OnLevelWasLoaded();

        // Do nothing if paused or not yet loaded
        if(Paused)
            return;

        // DeltaTime
        float dT = Time.deltaTime;

        // Apply the play-speed factor
        if(Globals.WorldView.PlaySpeed == GameSpeed.Fast)
            dT *= 2;
        else if(Globals.WorldView.PlaySpeed == GameSpeed.Faster)
            dT *= 4;

        TotalTime += dT;

        /*** Background Update ***/

        // Update background UV offsets
        Vector2 CameraPos = new Vector2(Camera.main.transform.position.x, -Camera.main.transform.position.y);
        for(int i = 0; i < 3; i++)
        {
            // Update UV pos
            BackgroundSprites[i].SetSpritePos(CameraPos * (float)(i + 1) * 0.2f + new Vector2(TotalTime, TotalTime) * 0.5f);

            // Update on-screen position (just follow camera)
            BackgroundSprites[i].SetPosition(-BackgroundSprites[i].GetGeometrySize() / 2.0f + new Vector2(CameraPos.x, -CameraPos.y));
        }

        /*** Update Enemy Ship Spawning ***/

        UpdateEnemySpawn();

        /*** Update Buildings ***/

        BuildingManager.Update();

        /*** Mouse Events ***/

        // Start of down press
        if(Input.GetMouseButtonDown(0))
        {
            // Get the ship we clicked on
            Vector2 WorldMousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
            TargetShip = ShipManager.GetShipAt(WorldMousePos);
            TargetBuilding = BuildingManager.GetBuildingAt(WorldMousePos);
        }

        // If the user does a full click on-screen...
        else if(Input.GetMouseButtonUp(0))
        {
            // Get the ship we released on, if any
            Vector2 WorldMousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition);

            // Find ship and building
            BaseShip ReleaseShip = ShipManager.GetShipAt(WorldMousePos);
            BaseBuilding ReleaseBuilding = BuildingManager.GetBuildingAt(WorldMousePos);

            // If the selected ships match, then we should show the UI
            if(TargetShip != null && TargetShip == ReleaseShip)
            {
                Paused = true;
                EntityMenu EntityView = gameObject.AddComponent(typeof(EntityMenu)) as EntityMenu;
                EntityView.LoadDetails(TargetShip);
                Globals.PushView(EntityView);
            }

            // If building..
            else if(TargetBuilding != null && TargetBuilding == ReleaseBuilding)
            {
                ContextMenuView.Target = TargetBuilding;
                ContextMenuView.enabled = true;
            }

            // Else, placing a building...
            else if(CurrentBuilding != null)
            {
                bool buildingAdded = BuildingManager.AddBuilding(CurrentBuilding);

                if(buildingAdded)
                {
                    CurrentBuilding = null;
                    PlacingBuilding = false;
                }
            }

            // Reset building UI
            else
            {
                ContextMenuView.enabled = false;
            }

            // Always reset the ship once selected or not
            TargetShip = null;
        }

        // Else if right-click mouse up, release building
        else if(Input.GetMouseButtonUp(1) && CurrentBuilding != null)
        {
            BuildingManager.DestroyBuilding(CurrentBuilding);
            CurrentBuilding = null;
            PlacingBuilding = false;
        }

        /*** Music Update ***/

        // Get total enemy ship count
        int EnemyCount = 0;
        foreach(BaseShip Ship in ShipManager.ShipsList)
        {
            if(Ship is EnemyShip)
                EnemyCount++;
        }

        // If enemies are gone, transition back to normal music
        if(EnemyCount <= 0)
            SongManager.TransitionAudio(false);

        /*** Building Placement ***/

        if(PlacingBuilding && CurrentBuilding == null)
            CurrentBuilding = BuildingManager.CreateBuilding("Config/Buildings/" + CurrBuildingConfig);

        if(CurrentBuilding != null)
            CurrentBuilding.Position = Camera.main.ScreenToWorldPoint(new Vector2(Input.mousePosition.x, Input.mousePosition.y));

        /*** Win/Lose Check ***/

        // Get player count: if no ships and no buildings left, we loose
        int Miners = 0, Attackers = 0, Destroyers = 0, Carriers = 0;
        Globals.WorldView.ShipManager.GetFriendlies(ref Miners, ref Attackers, ref Destroyers, ref Carriers);

        // Lose check:
        if(Miners == 0 && Attackers == 0 && Destroyers == 0 && Carriers == 0 && BuildingManager.WorldBuildings.Count == 0)
        {
            // Flip on pause state
            Paused = true;

            // Push pause menu
            LoseMenu LoseView = gameObject.AddComponent(typeof(LoseMenu)) as LoseMenu;
            LoseView.SetLevel(TargetLevel);
            Globals.PushView(LoseView);

            // Unlock the next level (if any)
            LevelManager.SetLevelUnlocked(TargetLevel + 1);
        }

        // Win check:
        else
        {
            // Has the player won?
            bool PlayerWon = false;

            // 1. Check for time
            if(WinLogic.IfWinTime && (int)TotalTime > WinLogic.WinTime)
                PlayerWon = true;

            // 2. Check for enemy kills
            if(WinLogic.IfWinKillAll)
            {
                // Get enemy count and make sure it is the last group
                Globals.WorldView.ShipManager.GetEnemies(ref Attackers, ref Destroyers, ref Carriers);
                if(GetNextEnemySpawnTime() < 0.0f && Attackers == 0 && Destroyers == 0 && Carriers == 0)
                    PlayerWon = true;
            }

            // 3. Check for resource consumption
            if(WinLogic.IfWinResources && SceneManager.AllResourcesConsumed())
                PlayerWon = true;

            // Player win check
            if(PlayerWon)
            {
                // Flip on pause state
                Paused = true;

                // Push pause menu
                WinMenu WinView = gameObject.AddComponent(typeof(WinMenu)) as WinMenu;
                WinView.SetLevel(TargetLevel);
                Globals.PushView(WinView);
            }
        }
    }
Example #41
0
 // Warning ship message
 public static String GetWarningMessage(BaseShip Ship)
 {
     return GetMessage("warning").Replace("$shipName", Ship.GetShipName());
 }
Example #42
0
 // Repaired ship message
 public static String GetRepairedMessage(BaseShip Ship)
 {
     return GetMessage("repaired").Replace("$shipName", Ship.GetShipName());
 }
Example #43
0
 // Destruction ship message
 public static String GetDestructionMessage(BaseShip Ship)
 {
     return GetMessage("destruction").Replace("$shipName", Ship.GetShipName());
 }
Example #44
0
        public BoatGump(Mobile from, BaseShip ship)
            : base(20, 30)
        {
            if (ship.Deleted)
                return;

            m_ship = ship;

            from.CloseGump(typeof(HouseGump));
            from.CloseGump(typeof(HouseListGump));
            from.CloseGump(typeof(HouseRemoveGump));

            bool isOwner = m_ship.Owner == from;

            AddPage(0);


            AddBackground(0, 0, 420, 430, 5054);
            AddBackground(10, 10, 400, 410, 3000);

            AddImage(130, 0, 100);

            List<string> lines = Wrap(m_ship.ShipName);

            if (lines != null)
            {
                for (int i = 0, y = (101 - (lines.Count * 14)) / 2; i < lines.Count; ++i, y += 14)
                {
                    string s = lines[i];

                    AddLabel(130 + ((143 - (s.Length * 8)) / 2), y, 0, s);
                }
            }

            AddLabel(55, 103, 0, "Ship Info"); // INFO
            AddButton(20, 103, 4005, 4007, 0, GumpButtonType.Page, 1);

            AddLabel(170, 103, 0, "Ownership"); // FRIENDS
            AddButton(135, 103, 4005, 4007, 0, GumpButtonType.Page, 2);

            AddLabel(295, 103, 0, "Options"); // OPTIONS
            AddButton(260, 103, 4005, 4007, 0, GumpButtonType.Page, 3);

            AddLabel(55, 390, 0, "Dock Vessel"); //dock
            AddButton(20, 390, 4005, 4007, 1, GumpButtonType.Reply, 0);

            AddLabel(200, 390, 0, "Rename Vessel"); //rename
            AddButton(165, 390, 4005, 4007, 2, GumpButtonType.Reply, 0);

            AddLabel(355, 390, 0, "Exit"); // EXIT
            AddButton(320, 390, 4005, 4007, 0, GumpButtonType.Reply, 0);

            // Info page
            AddPage(1);

            AddHtmlLocalized(150, 135, 100, 20, 1011242, false, false); // Owned by:
            AddHtml(220, 135, 100, 20, m_ship.GetOwnerName(), false, false);

            AddLabel(20, 250, 0, "Ship's Status: ");

            if (m_ship.Status == ShipStatus.Full)
            {
                AddLabel(110, 250, 1372-1, "Maximum Strength");
            }
            else if (m_ship.Status == ShipStatus.Half)
            {
                AddLabel(110, 250, 1357-1, "Half Strength");
            }
            else if (m_ship.Status == ShipStatus.Low)
            {
                AddLabel(110, 250, 133-1, "BOARDABLE!");
            }

            AddLabel(20, 275, 0, "Ship's Hull: ");

            AddLabel(110, 275, 0, m_ship.HullDurability + "/" + m_ship.MaxHullDurability);

            var percentage = (int)Math.Round(((double)m_ship.HullDurability / m_ship.MaxHullDurability) * 100);

            AddLabel(180, 275, 0, "(" + percentage + "%)");

            AddLabel(20, 300, 0, "Ship's Sails: ");

            AddLabel(110, 300, 0, m_ship.SailDurability + "/" + m_ship.MaxSailDurability);

            percentage = (int)Math.Round(((double)m_ship.SailDurability / m_ship.MaxSailDurability) * 100);

            AddLabel(180, 300, 0, "(" + percentage + "%)");

            AddLabel(55, 325, 0, "Embark");
            AddButton(20, 325, 4005, 4007, 3, GumpButtonType.Page, 1);

            AddLabel(255, 325, 0, "Disembark");
            AddButton(220, 325, 4005, 4007, 4, GumpButtonType.Page, 1);

            AddLabel(55, 350, 0, "Embark All Followers");
            AddButton(20, 350, 4005, 4007, 5, GumpButtonType.Page, 1);

            AddLabel(255, 350, 0, "Disembark All Followers");
            AddButton(220, 350, 4005, 4007, 6, GumpButtonType.Page, 1);



            // Friends page
            AddPage(2);

            AddLabel(45, 130, 0, "View Officers"); // List of captains
            AddButton(20, 130, 2714, 2715, 7, GumpButtonType.Reply, 0);

            AddLabel(45, 150, 0, "Add an Officer"); // Add a captains
            AddButton(20, 150, 2714, 2715, 8, GumpButtonType.Reply, 0);

            AddLabel(45, 170, 0, "Remove an Officer"); // Remove a captains
            AddButton(20, 170, 2714, 2715, 9, GumpButtonType.Reply, 0);

            AddLabel(45, 190, 0, "Clear all Officers"); // Clear captains list
            AddButton(20, 190, 2714, 2715, 10, GumpButtonType.Reply, 0);

            AddLabel(225, 130, 0, "View Deckhands"); // List of Deckhands
            AddButton(200, 130, 2714, 2715, 11, GumpButtonType.Reply, 0);

            AddLabel(225, 150, 0, "Add a Deckhand"); // Add a deckhand
            AddButton(200, 150, 2714, 2715, 12, GumpButtonType.Reply, 0);

            AddLabel(225, 170, 0, "Remove a Deckhand"); // Remove a deckhand
            AddButton(200, 170, 2714, 2715, 13, GumpButtonType.Reply, 0);

            AddLabel(225, 190, 0, "Clear all Deckhands"); // Clear deckhands list
            AddButton(200, 190, 2714, 2715, 14, GumpButtonType.Reply, 0);

            AddPage(3);

            AddLabel(45, 130, 0, "Scuttle Ship"); // List of captains
            AddButton(20, 130, 2714, 2715, 15, GumpButtonType.Reply, 0);
        }
		public NewRenameBoatPrompt( BaseShip boat )
		{
			m_Boat = boat;
		}
Example #46
0
 public ShipRenamePrompt(BaseShip ship)
 {
     m_ship = ship;
 }
Example #47
0
        public Map(string XmlPath)
        {
            var doc = new XmlDocument();
            doc.Load(XmlPath);

            //Basic
            var root = doc.SelectSingleNode("Map");

            LevelIndex = root.Attributes["LevelIndex"].InnerText;
            MapIndex = root.Attributes["MapIndex"].InnerText;
            Title = root.Attributes["Title"].InnerText;
            Description = root.Attributes["Description"].InnerText;
            Creator = root.Attributes["Creator"].InnerText;

            //Points
            var nodes = root.SelectSingleNode("Node");
            Node = new List<Point>();
            foreach (XmlNode x in nodes.ChildNodes)
            {
                //Basic
                var p = new Point();
                p.Type = x.Attributes["Type"] != null ? (PointType)Enum.Parse(typeof(PointType), x.Attributes["Type"].InnerText) : PointType.Normal;
                p.X = x.Attributes["X"] != null ? int.Parse(x.Attributes["X"].InnerText) : 0;
                p.Y = x.Attributes["Y"] != null ? int.Parse(x.Attributes["Y"].InnerText) : 0;
                p.CanSkip = x.Attributes["CanSkip"] != null ? Convert.ToBoolean(int.Parse(x.Attributes["CanSkip"].InnerText)) : false;
                p.Name = x.Attributes["Name"] != null ? x.Attributes["Name"].InnerText : "Start";

                //Routes
                var rx = x.SelectSingleNode("Routes");
                p.Routes = new List<Route>();
                if (rx != null)
                    foreach (XmlNode routex in rx.ChildNodes)
                    {
                        var s = new Route();
                        s.Target = routex.Attributes["Target"].InnerText;
                        s.Star = routex.Attributes["Star"] != null ? int.Parse(routex.Attributes["Star"].InnerText) : 0;
                        p.Routes.Add(s);
                    }

                //Enemies
                var ex = x.SelectSingleNode("Enemies");
                p.Enemies = new List<Fleet>();
                if (ex != null)
                    foreach (XmlNode enemx in ex.ChildNodes)
                    {
                        var e = new Fleet();
                        e.ID = int.Parse(enemx.Attributes["ID"].InnerText);
                        p.Enemies.Add(e);
                    }

                //Items
                var ix = x.SelectSingleNode("Items");
                p.Items = new List<Item>();
                if (ix != null)
                    foreach (XmlNode itemx in ix.ChildNodes)
                    {
                        var i = new Item();
                        i.Type = (ItemType)Enum.Parse(typeof(ItemType), itemx.Attributes["Type"].InnerText);
                        i.Value = int.Parse(itemx.Attributes["Value"].InnerText);
                        p.Items.Add(i);
                    }
                if (ex == null && ix != null)
                    p.Type = PointType.Resources;
                if (ex == null && ix == null)
                    p.Type = PointType.Anchor;
                if (p.CanSkip)
                    p.Type = PointType.CanSkip;

                Node.Add(p);
            }

            //Fleets
            Fleets = new List<Fleet>();
            var fn = root.SelectSingleNode("Fleets");
            foreach (XmlNode x in fn.ChildNodes)
            {
                var f = new Fleet();
                f.ID = int.Parse(x.Attributes["ID"].InnerText);
                f.Ships = new List<BaseShip>();
                foreach (XmlNode sx in x)
                {
                    var s = new BaseShip();
                    s.ID = int.Parse(sx.Attributes["ID"].InnerText);
                    f.Ships.Add(s);
                }
                Fleets.Add(f);
            }
            CheckWays(Node[0]);
        }
 void Awake()
 {
     ship = GetComponent<BaseShip>();
     body = GetComponent<Rigidbody2D>();
 }
Example #49
0
 // Is the given ship an enemy?
 public bool IsEnemy(BaseShip Ship)
 {
     return (Ship is EnemyShip);
 }
Example #50
0
 public void Start()
 {
     this.myShip = this.GetComponentInParent((typeof(BaseShip))) as BaseShip;
     this.fullHP = this.myShip.getHP();
 }
Example #51
0
 protected BaseShipItem(BaseShip ship, int itemID)
     : this(ship, itemID, Point3D.Zero)
 {
 }
Example #52
0
    /*** Public Methods ***/
    // Add a new projectile
    public void AddProjectile(BaseShip Owner, BaseShip_WeaponTypes Type, Vector2 Source, Vector2 Velocity)
    {
        // Allocate the object as needed
        Projectile Bullet = new Projectile();
        Bullet.Type = Type;
        Bullet.Vecloty = Velocity;
        Bullet.Owner = Owner;

        // Load from config files
        String TypeName = "";
        int Damage = 0;
        if(Type == BaseShip_WeaponTypes.Gatling)
        {
            TypeName = "Gatling";
            Damage = 1;
        }
        else if(Type == BaseShip_WeaponTypes.Laser)
        {
            TypeName = "Laser";
            Damage = 3;
        }
        else if(Type == BaseShip_WeaponTypes.Missile)
        {
            TypeName = "Missile";
            Damage = 8;
        }
        else if(Type == BaseShip_WeaponTypes.RailGun)
        {
            TypeName = "RailGun";
            Damage = 10;
        }
        else
        {
            Debug.Log("Unable to add projectile to scene");
            return;
        }

        Bullet.Damage = Damage;

        // Load sprite
        Bullet.ProjectileSprite = new Sprite("Textures/" + ProjectileInfo.GetKey_String("General", "Texture"));

        Vector2 SPos = ProjectileInfo.GetKey_Vector2(TypeName, "Pos");
        Vector2 SSize = ProjectileInfo.GetKey_Vector2(TypeName, "Size");
        int SCount = ProjectileInfo.GetKey_Int(TypeName, "Count");
        float STime = ProjectileInfo.GetKey_Float(TypeName, "Time");

        // Set sprite size
        Bullet.ProjectileSprite.SetSpritePos(SPos);
        Bullet.ProjectileSprite.SetSpriteSize(SSize);

        Bullet.ProjectileSprite.SetGeometrySize(Bullet.ProjectileSprite.GetSpriteSize() * 0.3f);
        Bullet.ProjectileSprite.SetRotationCenter(Bullet.ProjectileSprite.GetGeometrySize() / 2.0f);
        Bullet.ProjectileSprite.SetPosition(Source);

        // Set sprite animation
        Bullet.ProjectileSprite.SetAnimation(SPos, SSize, SCount, STime);

        // Set the correct angle from the velocity, so that we are facing out
        Vector2 Normal = Velocity.normalized;
        float Theta = (float)Math.Atan2(Normal.y, Normal.x);

        // Apply angle
        Bullet.ProjectileSprite.SetRotation(Theta);

        // Register sprite and bullet
        Globals.WorldView.SManager.AddSprite(Bullet.ProjectileSprite);
        Projectiles.Add(Bullet);

        // Add glow ontop of the initial shot
        AddGlow(Source);
    }
 //AIinfo
 void Awake()
 {
     m_baseShip = GetComponent<BaseShip>();
 }
Example #54
0
 protected BaseShipContainer(BaseShip ship, int itemID)
     : this(ship, itemID, Point3D.Zero)
 {
 }
 public void ApplyHardpoint(BaseHardpoint a_hardpoint, BaseShip a_parent)
 {
     m_hardpoint = a_hardpoint;
     m_hardpoint.transform.localPosition = m_hullLocation;
     m_hardpoint.m_totalRotation = m_totalRotation;
     m_hardpoint.m_parent = a_parent;
 }
 public void AddShip(BaseShip a_shipScript)
 {
     m_shipList.Add(a_shipScript.GetComponent<ShipController>());
     m_fleetControllerList[(int)a_shipScript.GetIFF()].AddShip(a_shipScript.GetComponent<ShipController>());
 }