Package com.threerings.crowd.data

Examples of com.threerings.crowd.data.BodyObject


            throw new InvocationException(ZoneCodes.INTERNAL_ERROR);
        }

        // look up the caller's current zone id and make sure it is happy about their departure
        // from the current zone
        BodyObject body = _locator.forClient(caller);
        ZoneManager ozmgr = getZoneManager(((ZonedBodyObject)caller).getZoneId());
        if (ozmgr != null) {
            String msg = ozmgr.ratifyBodyExit(body);
            if (msg != null) {
                throw new InvocationException(msg);
            }
        }

        // look up the zone manager for the zone
        ZoneManager zmgr = getZoneManager(zoneId);
        if (zmgr == null) {
            log.warning("Requested to enter a zone for which we have no manager",
                "user", body.who(), "zoneId", zoneId);
            throw new InvocationException(ZoneCodes.NO_SUCH_ZONE);
        }

        // resolve the zone and move the user
        zmgr.resolveZone(zoneId, createZoneMoveHandler(zmgr, body, sceneId, sceneVer, listener));
View Full Code Here


            return true;
        }

        public void removeBody (int bodyOid)
        {
            BodyObject body = (BodyObject)remove(bodyOid);
            if (body == null) {
                log.warning("Requested to remove unknown body from cluster",
                    "cloid", _clobj.getOid(), "size", size(), "who", bodyOid);
                return;
            }

            if (body.isActive()) {
                body.startTransaction();
            }
            try {
                _ssobj.startTransaction();
                try {
                    ((ClusteredBodyObject)body).setClusterOid(-1);
                    bodyRemoved(this, body); // do the hokey pokey
                    if (_clobj != null) {
                        _clobj.removeFromOccupants(bodyOid);
                        _ssobj.updateClusters(_cluster);
                    }

                } finally {
                    _ssobj.commitTransaction();
                }

            } finally {
                if (body.isActive()) {
                    body.commitTransaction();
                }
            }

//             log.debug("Removed " + bodyOid + " from "+ this + ".");
View Full Code Here

        throws InvocationException
    {
//         Log.info("Handling invite request [source=" + source + ", invitee=" + invitee +
//                  ", config=" + config + "].");

        BodyObject source = (BodyObject)caller;

        // ensure that the invitee is online at present
        BodyObject target = _locator.lookupBody(invitee);
        if (target == null) {
            throw new InvocationException(INVITEE_NOT_ONLINE);
        }

        int inviteId = invite(source, target, config);
View Full Code Here

    // from interface ParlorProvider
    public void startSolitaire (ClientObject caller, GameConfig config,
                                ParlorService.ConfirmListener listener)
        throws InvocationException
    {
        BodyObject user = (BodyObject)caller;

        log.debug("Processing start solitaire [caller=" + user.who() + ", config=" + config + "].");

        try {
            // just this fellow will be playing
            if (config.players == null || config.players.length == 0) {
                config.players = new Name[] { user.getVisibleName() };
            }

            // create the game manager and begin its initialization process
            createGameManager(config);
View Full Code Here

        // obtain a casted reference
        _gobj = (GameObject)plobj;

        // if this place object is not our current location we'll need to add it as an auxiliary
        // chat source
        BodyObject bobj = (BodyObject)_ctx.getClient().getClientObject();
        if (bobj.location == null || bobj.location.placeOid != plobj.getOid()) {
            _ctx.getChatDirector().addAuxiliarySource(_gobj, GameCodes.GAME_CHAT_TYPE);
        }

        // and add ourselves as a listener
        _gobj.addListener(this);

        // we don't want to claim to be finished until any derived classes that overrode this
        // method have executed, so we'll queue up a runnable here that will let the game manager
        // know that we're ready on the next pass through the distributed event loop
        log.info("Entering game " + _gobj.which() + ".");
        if (_gobj.getPlayerIndex(bobj.getVisibleName()) != -1) {
            _ctx.getClient().getRunQueue().postRunnable(new Runnable() {
                public void run () {
                    // finally let the game manager know that we're ready to roll
                    playerReady();
                }
View Full Code Here

         * Swaps the inviter and invitee which is necessary when the invitee responds with a
         * counter-invitation.
         */
        public void swapControl ()
        {
            BodyObject tmp = inviter;
            inviter = invitee;
            invitee = tmp;
        }
View Full Code Here

    // from interface TableProvider
    public void createTable (ClientObject caller, TableConfig tableConfig, GameConfig config,
                             TableService.ResultListener listener)
        throws InvocationException
    {
        BodyObject creator = (BodyObject)caller;

        // if we're managing tables in a place, make sure the creator is an occupant of the place
        // in which they are requesting to create a table
        if (_dobj instanceof PlaceObject &&
            !((PlaceObject)_dobj).occupants.contains(creator.getOid())) {
            log.warning("Requested to create a table in a place not occupied by the creator",
                "creator", creator, "ploid", _dobj.getOid());
            throw new InvocationException(INTERNAL_ERROR);
        }
View Full Code Here

    public void bodyEntered (int bodyOid)
    {
        super.bodyEntered(bodyOid);

        // if the game is in play and this is a player, load their ratings
        BodyObject occupant = (BodyObject)_omgr.getObject(bodyOid);
        if (shouldRateGame() && _gobj.isInPlay() && isPlayer(occupant)) {
            PlayerRating rating = maybeCreateRating(occupant);
            if (rating != null) {
                loadRatings(Collections.singleton(rating));
            }
View Full Code Here

    // from interface TableProvider
    public void joinTable (ClientObject caller, int tableId, int position,
                           TableService.InvocationListener listener)
        throws InvocationException
    {
        BodyObject joiner = (BodyObject)caller;

        // make sure the caller is not already in a table
        if (_boidMap.containsKey(joiner.getOid())) {
            throw new InvocationException(ALREADY_AT_TABLE);
        }

        // look the table up
        Table table = _tables.get(tableId);
View Full Code Here

        // load up the ratings for all players in this game; also make a note of the persistent
        // player id of each player position for seated table games
        List<PlayerRating> toLoad = Lists.newArrayList();
        for (int ii = 0, ll = _gobj.occupants.size(); ii < ll; ii++) {
            BodyObject bobj = (BodyObject)_omgr.getObject(_gobj.occupants.get(ii));
            int pidx = _gmgr.getPlayerIndex(bobj.getVisibleName());
            if (pidx != -1) {
                _playerIds[pidx] = _gmgr.getPlayerPersistentId(bobj);
            }
            PlayerRating rating = maybeCreateRating(bobj);
            if (rating != null) {
View Full Code Here

TOP

Related Classes of com.threerings.crowd.data.BodyObject

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.