Example #1
0
        public PlayerCombatData(ScriptMessageReader mr, int version)
        {
            this._playerID      = mr.ReadInteger();
            this._victoryStatus = (GameSession.VictoryStatus)mr.ReadInteger();
            this.Construct();
            int num1 = mr.ReadInteger();

            for (int index = 0; index < num1; ++index)
            {
                this._shipData.Add(new Kerberos.Sots.Strategy.ShipData()
                {
                    designID       = mr.ReadInteger(),
                    damageDealt    = mr.ReadSingle(),
                    damageReceived = mr.ReadSingle(),
                    killCount      = mr.ReadInteger(),
                    destroyed      = mr.ReadBool()
                });
            }
            int num2 = mr.ReadInteger();

            for (int index1 = 0; index1 < num2; ++index1)
            {
                Kerberos.Sots.Strategy.PlanetData planetData = new Kerberos.Sots.Strategy.PlanetData();
                planetData.orbitalObjectID = mr.ReadInteger();
                planetData.imperialDamage  = mr.ReadDouble();
                int num3 = mr.ReadInteger();
                planetData.civilianDamage = new List <PopulationData>();
                for (int index2 = 0; index2 < num3; ++index2)
                {
                    PopulationData populationData = new PopulationData()
                    {
                        faction = mr.ReadString(),
                        damage  = mr.ReadDouble()
                    };
                }
                planetData.infrastructureDamage = mr.ReadSingle();
                planetData.terraDamage          = mr.ReadSingle();
                this._planetData.Add(planetData);
            }
            int num4 = mr.ReadInteger();

            for (int index = 0; index < num4; ++index)
            {
                this._weaponData.Add(new Kerberos.Sots.Strategy.WeaponData()
                {
                    weaponID    = mr.ReadInteger(),
                    damageDealt = mr.ReadSingle()
                });
            }
            if (version >= 1)
            {
                this._fleetCount = mr.ReadInteger();
            }
            else
            {
                this._fleetCount = 0;
            }
        }
Example #2
0
 public override bool OnEngineMessage(InteropMessageID messageId, ScriptMessageReader message)
 {
     if (messageId != InteropMessageID.IMID_SCRIPT_OBJECT_SETPROP || !(message.ReadString() == "Position"))
     {
         return(false);
     }
     this._position = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle());
     return(true);
 }
Example #3
0
        public override bool OnEngineMessage(InteropMessageID messageID, ScriptMessageReader message)
        {
            switch (messageID)
            {
            case InteropMessageID.IMID_SCRIPT_MANEUVER_INFO:
                this.m_CurrentPosition.X = message.ReadSingle();
                this.m_CurrentPosition.Y = message.ReadSingle();
                this.m_CurrentPosition.Z = message.ReadSingle();
                this.m_Facing.X          = message.ReadSingle();
                this.m_Facing.Y          = message.ReadSingle();
                this.m_Facing.Z          = message.ReadSingle();
                this.HasReceivedAnUpdate = true;
                return(true);

            case InteropMessageID.IMID_SCRIPT_FORMATION_REMOVE_SHIP:
                int shipID = message.ReadInteger();
                if (this._parentShipFormation != null)
                {
                    this._parentShipFormation.RemoveShip(shipID);
                }
                return(true);

            default:
                App.Log.Warn("Unhandled message (id=" + (object)messageID + ") in FormationDefinition.", "combat");
                return(false);
            }
        }
Example #4
0
        public override bool OnEngineMessage(InteropMessageID messageId, ScriptMessageReader message)
        {
            switch (messageId)
            {
            case InteropMessageID.IMID_SCRIPT_OBJECT_SETPROP:
                string str = message.ReadString();
                if (str == "Position")
                {
                    this._position = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle());
                    return(true);
                }
                if (str == "ShipSpeedScale")
                {
                    this._shipSpeedState = (ShipSpeedState)message.ReadInteger();
                    return(true);
                }
                if (str == "TargetFacingAngle")
                {
                    this._targetFacingAngle = (TargetFacingAngle)message.ReadInteger();
                    return(true);
                }
                break;

            case InteropMessageID.IMID_SCRIPT_MANEUVER_INFO:
                this._position    = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle());
                this._rotation    = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle());
                this._velocity    = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle());
                this._destination = new Vector3(message.ReadSingle(), message.ReadSingle(), message.ReadSingle());
                return(true);

            default:
                App.Log.Warn("Unhandled message (id=" + (object)messageId + ").", "combat");
                break;
            }
            return(false);
        }
Example #5
0
 public override bool OnEngineMessage(InteropMessageID messageId, ScriptMessageReader message)
 {
     if (messageId == InteropMessageID.IMID_SCRIPT_OBJECT_SETPROP)
     {
         string str = message.ReadString();
         if (str == "Update")
         {
             this._percentConsumed = message.ReadSingle();
             return(true);
         }
         if (str == "IsActive")
         {
             this._isActive = message.ReadBool();
             return(true);
         }
     }
     return(false);
 }
        public override void OnEngineMessage(InteropMessageID messageID, ScriptMessageReader mr)
        {
            switch (messageID)
            {
            case InteropMessageID.IMID_SCRIPT_SYNC_DEFENSE_POSITIONS:
                int num1 = mr.ReadInteger();
                for (int index1 = 0; index1 < num1; ++index1)
                {
                    mr.ReadInteger();
                    int num2 = mr.ReadInteger();
                    for (int index2 = 0; index2 < num2; ++index2)
                    {
                        if (mr.ReadBool())
                        {
                            bool flag = mr.ReadBool();
                            this.App.GameDatabase.UpdateShipSystemPosition(mr.ReadInteger(), !flag ? new Matrix?() : new Matrix?(new Matrix(mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle())));
                        }
                    }
                }
                if (this._finishing)
                {
                    this.App.SwitchGameState <StarMapState>();
                    break;
                }
                break;

            case InteropMessageID.IMID_SCRIPT_SYNC_DEFENSEBOAT_DATA:
                int shipID    = mr.ReadInteger();
                int OrbitalID = mr.ReadInteger();
                this.App.GameDatabase.RemoveSDBByShipID(shipID);
                if (OrbitalID != 0)
                {
                    this.App.GameDatabase.InsertSDB(OrbitalID, shipID);
                    break;
                }
                break;
            }
            base.OnEngineMessage(messageID, mr);
        }
Example #7
0
        public override void OnEngineMessage(InteropMessageID messageID, ScriptMessageReader mr)
        {
            switch (messageID)
            {
            case InteropMessageID.IMID_SCRIPT_OBJECT_RELEASE:
                this.RemoveObject(mr);
                break;

            case InteropMessageID.IMID_SCRIPT_OBJECTS_RELEASE:
                this.RemoveObjects(mr);
                break;

            case InteropMessageID.IMID_SCRIPT_SYNC_FLEET_POSITIONS:
                mr.ReadInteger();
                int num = mr.ReadInteger();
                for (int index = 0; index < num; ++index)
                {
                    bool flag = mr.ReadBool();
                    this.App.GameDatabase.UpdateShipFleetPosition(mr.ReadInteger(), !flag ? new Vector3?() : new Vector3?(new Vector3(mr.ReadSingle(), mr.ReadSingle(), mr.ReadSingle())));
                }
                if (!this._finalSync)
                {
                    break;
                }
                this.App.SwitchGameState <StarMapState>();
                break;
            }
        }