Package gwlpr.mapshard.models

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


     * @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

     * @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

     * @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

     */
    @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

        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

    {
        if (event.getHandle().get().getPlayerState() == PlayerState.LoadingInstance)
        {
            LOGGER.debug("Starting instance load.");
           
            ClientBean client = event.getHandle().get();
           
            // create a new entity of the character of this client
            // NOTE THAT FOR IDENTIFICATION PURPOSES, WE USE THE CLIENTS UID FOR
            // ITS CHARACTER ENTITY AS WELL!
            WorldPosition pos = getRandomSpawn();
            Entity player = CharacterFactory.createCharacter(event.getHandle().getUid(), client.getCharacter(), pos, entityManager);

            client.setEntity(player);
            client.setAgentIDs(player.get(AgentIdentifiers.class));

            // using the attachment now looks a bit ugly,
            // because we use the components here directly
            // (this should not happen with other components!)
            InstanceLoadView.instanceHead(client.getChannel());
            InstanceLoadView.charName(client.getChannel(), client.getCharacter().getName());
            InstanceLoadView.districtInfo(client.getChannel(), client.getAgentIDs().localID, world);
        }
    }
View Full Code Here

    @Event.Handler
    public void onInstanceLoadRequestSpawnPoint(P129_InstanceLoadRequestSpawnPoint action)
    {
        LOGGER.debug("Got the instance load request spawn point packet");
       
        ClientBean client = ClientBean.get(action.getChannel());

        // fetch the players postion (this was already initialized by the handshake controller,
        // when it instructed some other class to create the entity
        Entity et = client.getEntity();
        WorldPosition pos = et.get(Position.class).position;

        InstanceLoadView.sendSpawnPoint(client.getChannel(), pos, world.getMap().getHash());
    }
View Full Code Here

    @Event.Handler
    public void onInstanceLoadRequestAgentData(P137_InstanceLoadRequestAgentData action)
    {
        LOGGER.debug("Got the instance load request player data packet");
       
        ClientBean client = ClientBean.get(action.getChannel());

        // fetch the player entity..
        Entity et = client.getEntity();

        InstanceLoadView.sendAgentData(client.getChannel(), et);

        // activate heart beat and ping and such
        client.setPlayerState(PlayerState.Playing);

        // unblind the player
        et.get(View.class).isBlind = false;
    }
View Full Code Here

     * @param chatMsg
     */
    @Event.Handler
    public void onChatMessage(P093_ChatMessage chatMsg)
    {
        ClientBean client = ClientBean.get(chatMsg.getChannel());

        // extract the whole prefix message, get the channel prefix and the actual message
        String prfMsg = chatMsg.getPrefixedMessage();
        ChatChannel chan = ChatChannel.getFromPrefix(prfMsg.charAt(0));
        String msg = prfMsg.substring(1);

        // failcheck
        if (chan == null || msg == null || msg.equals("")) { return; }
       
        LOGGER.debug("Got new chat message for channel {}: {}", chan.name(), msg);

        // if it's a special channel we might want to distinguish between
        // different actions.
        // there is 3 types: the usual ingame stuff; whisper; command

        if (chan == ChatChannel.Command)
        {
            aggregator.triggerEvent(new ChatCommandEvent(client.getEntity(), msg));
            return;
        }

        if (chan == ChatChannel.Whisper)
        {
            // TODO
            // no internal event, communicate with the login server directly
            return;
        }

        // we have a standart message. trigger the event
        aggregator.triggerEvent(new ChatMessageEvent(client.getEntity(), chan, msg));
    }
View Full Code Here

TOP

Related Classes of gwlpr.mapshard.models.ClientBean

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.