Ejemplo n.º 1
0
        public static BaseRequest messageFromBytes(byte[] buffer)
        {
            VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length);
            TYPE t = (TYPE)stream.getUShort();
            stream.Seek(0, System.IO.SeekOrigin.Begin);

            BaseRequest msg = null;
            switch (t) {
                case TYPE.FLEET:
                    msg = new FleetRequest();
                    break;
                case TYPE.SETTINGS:
                    msg = new SettingsRequest();
                    break;
                case TYPE.VIOLATIONS:
                    msg = new ViolationsRequest();
                    break;
                case TYPE.DISOWN:
                    msg = new DisownRequest();
                    break;
                case TYPE.STOPGRID:
                    msg = new StopGridRequest();
                    break;
            }

            if (msg != null)
                msg.deserialize(stream);
            return msg;
        }
Ejemplo n.º 2
0
 public bool requestViolations(String hullClassString = "")
 {
     log("Sending Violations request", "requestViolations");
     try {
         ViolationsRequest req = new ViolationsRequest();
         req.ReturnAddress = MyAPIGateway.Session.Player.PlayerID;
         send(req);
         return(true);
     }
     catch (Exception e) {
         log("Exception occured: " + e, "requestViolations");
         return(false);
     }
 }
Ejemplo n.º 3
0
        private void processViolationsRequest(ViolationsRequest req)
        {
            // Get an Owner object from the player ID of the request
            GridOwner.OWNER owner = GridOwner.ownerFromPlayerID(req.ReturnAddress);

            // Retrieve that owner's fleet
            FactionFleet fleet = GardenConquest.Core.StateTracker.
                                 getInstance().getFleet(owner.FleetID, owner.OwnerType);

            // Get the fleet's juicy description
            String body = fleet.violationsToString();

            // build the title
            String title = "";

            switch (owner.OwnerType)
            {
            case GridOwner.OWNER_TYPE.FACTION:
                title = "Your Faction's Fleet's Violations";
                break;

            case GridOwner.OWNER_TYPE.PLAYER:
                title = "Your Fleet Violations";
                break;
            }

            // send the response
            DialogResponse resp = new DialogResponse()
            {
                Body        = body,
                Title       = title,
                Destination = new List <long>()
                {
                    req.ReturnAddress
                },
                DestType = BaseResponse.DEST_TYPE.PLAYER
            };

            send(resp);
        }
Ejemplo n.º 4
0
        public static BaseRequest messageFromBytes(byte[] buffer)
        {
            VRage.ByteStream stream = new VRage.ByteStream(buffer, buffer.Length);
            TYPE             t      = (TYPE)stream.getUShort();

            stream.Seek(0, System.IO.SeekOrigin.Begin);

            BaseRequest msg = null;

            switch (t)
            {
            case TYPE.FLEET:
                msg = new FleetRequest();
                break;

            case TYPE.SETTINGS:
                msg = new SettingsRequest();
                break;

            case TYPE.VIOLATIONS:
                msg = new ViolationsRequest();
                break;

            case TYPE.DISOWN:
                msg = new DisownRequest();
                break;

            case TYPE.STOPGRID:
                msg = new StopGridRequest();
                break;
            }

            if (msg != null)
            {
                msg.deserialize(stream);
            }
            return(msg);
        }
Ejemplo n.º 5
0
 public bool requestViolations(String hullClassString = "")
 {
     log("Sending Violations request", "requestViolations");
     try {
         ViolationsRequest req = new ViolationsRequest();
         req.ReturnAddress = MyAPIGateway.Session.Player.PlayerID;
         send(req);
         return true;
     }
     catch (Exception e) {
         log("Exception occured: " + e, "requestViolations");
         return false;
     }
 }
Ejemplo n.º 6
0
        private void processViolationsRequest(ViolationsRequest req)
        {
            // Get an Owner object from the player ID of the request
            GridOwner.OWNER owner = GridOwner.ownerFromPlayerID(req.ReturnAddress);

            // Retrieve that owner's fleet
            FactionFleet fleet = GardenConquest.Core.StateTracker.
                getInstance().getFleet(owner.FleetID, owner.OwnerType);

            // Get the fleet's juicy description
            String body = fleet.violationsToString();

            // build the title
            String title = "";
            switch (owner.OwnerType) {
                case GridOwner.OWNER_TYPE.FACTION:
                    title = "Your Faction's Fleet's Violations";
                    break;
                case GridOwner.OWNER_TYPE.PLAYER:
                    title = "Your Fleet Violations";
                    break;
            }

            // send the response
            DialogResponse resp = new DialogResponse() {
                Body = body,
                Title = title,
                Destination = new List<long>() { req.ReturnAddress },
                DestType = BaseResponse.DEST_TYPE.PLAYER
            };

            send(resp);
        }