Examples of ClientBean


Examples of ehistory.web.server.frontend.ClientBean

            throw new RuntimeException(e);
        }

        // get client bean
        HttpSession session = request.getSession();
        ClientBean clientBean = (ClientBean) session.getAttribute(CLIENT_BEAN);
        if (clientBean == null) {
            ServletContext context = session.getServletContext();
            BackendBean backendBean = (BackendBean) context.getAttribute(BACKEND_BEAN);
            if (backendBean == null) {
                backendBean = new BackendBean();
                context.setAttribute(BACKEND_BEAN, backendBean);
            }
            clientBean = new ClientBean();
            clientBean.setBackendBean(backendBean);
            session.setAttribute(CLIENT_BEAN, clientBean);
        }

        // process request
        FlexResponse flexResponse;
View Full Code Here

Examples of gwlpr.loginshard.models.ClientBean

    {
        LOGGER.debug("Got the character play info packet");

        // get the channel attachment for that channel
        Channel channel = action.getChannel();
        ClientBean client = ClientBean.get(channel);
        Handle<ClientBean> clientHandle = ClientBean.getHandle(channel);

        // failcheck
        if (client == null) { channel.close(); return; }

        // update the login count
        client.setLoginCount(action.getLoginCount());

        // TODO: check mapId before directly creating a mapshard for it!
        // TODO: check the following values!
        // we ignore the instance number because the server needs to chose that...
        int mapId = (int)action.getGameMapId();
        int instanceNum = (int)action.getInstanceNumber();
        DistrictRegion region = DistrictRegion.values()[(int)action.getRegion()];
        DistrictLanguage language = DistrictLanguage.values()[(int)action.getLanguage()];
       
        // TODO: enable outposts
        Handle<GameAppContext> mapShardHandle = model.getOrCreateExplorable(mapId);
            // let the model do the work...
            //Handle<GameAppContext> mapShardHandle = model.getOrCreate(mapId, region, language, instanceNum, true);

        // lets check if we were successfull with the game app creation
        if (mapShardHandle == null)
        {
            LOGGER.warn("Was unable to create a game app! Please check the log for other errors!");
            StreamTerminatorView.send(channel, ErrorCode.InternalServerError);
            return;
        }

        // inform the model that we'r waiting for a mapshard to accept a client
        model.clientWaitingFor(clientHandle, mapShardHandle);

        // dont forget to update the client bean (it now has a mapshard, yay :)
        client.setMapShardHandle(mapShardHandle);

        LOGGER.debug("Asking a map shard to accept a client.");

        mapShardHandle.get().trigger(
                new LSRequest_AcceptClient(
                    clientHandle.getUid(),
                    client.getAccount(),
                    client.getCharacter()));

        // we will notify the client when the mapshard replies.
    }
View Full Code Here

Examples of gwlpr.loginshard.models.ClientBean

        }
       
        LOGGER.info("Client successfully logged in. [email {} ]", email);
       
        // create the client's bean
        ClientBean client = new ClientBean(channel, model.getAccount(), model.getChara());
       
        // register it
        ClientBean.set(channel, clientHandleRegistry.register(client));

        // send all login specific packets as a reply
View Full Code Here

Examples of gwlpr.loginshard.models.ClientBean

    {
        LOGGER.debug("Got the character play name packet");
       
        // get the session attachment for that session
        Channel channel = action.getChannel();
        ClientBean client = ClientBean.get(channel);
       
        // failcheck
        if (client == null) { channel.close(); return; }
       
        // set login counter
        client.setLoginCount(action.getLoginCount());
       
        // check the submitted information
        LoginModel model = new LoginModel(client.getAccount(), action.getCharacterName());
       
        if (!model.hasChar())
        {
            LOGGER.info("Manipulation detected: Trying to access a character that is not connected to this account.");
            channel.close();
            return;
        }
       
        client.setCharacter(model.getChara());
       
        LoginView.sendFriendInfo(channel, ErrorCode.None);
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

    @Event.Handler
    public void onKeyboardMove(P054_MovementUpdate action)
    {
        // TODO verify data like mapData.validPosition(pos):boolean

        ClientBean client = ClientBean.get(action.getChannel());
       
        Entity et = client.getEntity();
        Position pos = et.get(Position.class);
        Direction dir = et.get(Direction.class);
        Movement move = et.get(Movement.class);

        // extract info
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     * @param   action
     */
    @Event.Handler
    public void onKeyboardStopMoving(P064_MovementStop action)
    {
        ClientBean client = ClientBean.get(action.getChannel());
       
        Entity et = client.getEntity();
        Position pos = et.get(Position.class);
        Movement move = et.get(Movement.class);

        // extract info
        WorldPosition position = new WorldPosition(
                action.getPositionVector(),
                (int) action.getPositionPlane());
       
        // this should not be done directly:
        pos.position = position;
       
        // TODO check if the client is still in sync!
        // else do nothing but send a position update packet
       
        // also update the movement state, it can be done right now with no harm
        move.moveState = MovementState.NotMoving;

        // the internal event:
        aggregator.triggerEvent(new StopMovingEvent(client.getEntity()));
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     * @param       action
     */
    @Event.Handler
    public void onKeyboardRotate(P057_RotateAgent action)
    {
        ClientBean client = ClientBean.get(action.getChannel());
       
        float rot1 = Float.intBitsToFloat((int)action.getRotation1());
        float rot2 = Float.intBitsToFloat((int)action.getRotation2());

        // send internal event
        aggregator.triggerEvent(new RotateEvent(client.getEntity(), rot1, rot2));
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     * @param       action
     */
    @Event.Handler
    public void onClickLocation(P055_GotoPostion action)
    {
        ClientBean client = ClientBean.get(action.getChannel());

        // TODO implement me!
        // we can also choose to ignore this, if the pathing stuff is too complex.
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     */
    @Event.Handler
    public void onAcceptClientRequest(LSRequest_AcceptClient event)
    {
        // create a new uninitialized client bean...
        ClientBean client = new ClientBean(event.getAccount(), event.getCharacter());

        // and add it to our controller internal mapping...
        uninitializedClients.put(event.getClientUid(), client);

        // and tell the LS that we're ready
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

        if (clientUid == null) { return; }

        LOGGER.debug("Client accepted.");

        // initialize the client bean first
        ClientBean client = uninitializedClients.remove(clientUid);
        client.init(event.getChannel());

        PlayerState state = world.isCharCreate() ? PlayerState.CreatingCharacter : PlayerState.LoadingInstance;
        client.setPlayerState(state);

        // sign the client
        Channel channel = client.getChannel();
        channel.attr(GameAppContextKey.KEY).set(context.get());
        channel.attr(GameAppContextKey.IS_SET).set(true);

        // register it
        // this will trigger an event from the client registry notification decorator,
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.