Examples of ClientBean


Examples of gwlpr.mapshard.models.ClientBean

    {
        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

Examples of gwlpr.mapshard.models.ClientBean

    @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

Examples of gwlpr.mapshard.models.ClientBean

    @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

Examples of gwlpr.mapshard.models.ClientBean

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

Examples of gwlpr.mapshard.models.ClientBean

     */
    @Event.Handler
    public void onPingReply(P003_PingReply pingReply)
    {
        // update the client's latency
        ClientBean client = ClientBean.get(pingReply.getChannel());
       
        int latency = (int) (System.currentTimeMillis() - lastPingTimeStamp);
        client.setLatency(latency);
       
        TimeDeltaView.pingReply(client.getChannel(), latency);
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     * @param pingRequest
     */
    @Event.Handler
    public void onPingRequest(P005_PingRequest pingRequest)
    {
        ClientBean client = ClientBean.get(pingRequest.getChannel());
       
        TimeDeltaView.pingReply(client.getChannel(), client.getLatency());
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

        else if (!senderChatOptions.availableCommands.contains(command))
        {
            // command is not available for the sender
           
            // try to get the client
            ClientBean client = clientRegistry.getObj(chatCmd.getSender().getUuid());
           
            if (client == null) { return; }

            // if the sender was a network client (as opposed to NPCs etc.)
            // we'll tell her that the execution failed:
            String cmdFailed = "The command does not exist or you dont have sufficient permissions to execute it.";
           
            ChatMessageView.sendMessage(
                    client.getChannel(),
                    0,
                    ChatColor.DarkOrange_DarkOrange,
                    Strings.CmdNotAvail.text());
           
            return;
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

    public void onValidateCreatedCharacter(P132_ValidateCreatedCharacter action)
    {
        LOGGER.debug("Got the validate created character packet");

        // extract the session and attachment...
        ClientBean client = ClientBean.get(action.getChannel());

        // extract the data of the new char
        String characterName = action.getCharName();

        // get character properties
        byte[] appearance = action.getAppearanceAndProfession();
       
        byte sex = (byte) (appearance[0] & 1);
        byte height = (byte) ((appearance[0] >> 1) & 0xF);
        byte skin = (byte) (((appearance[0] >> 5) | (appearance[1] << 3)) & 0x1F);
        byte haircolor = (byte) ((appearance[1] >> 2) & 0x1F);
        byte face = (byte) (((appearance[1] >> 7) | (appearance[2] << 1)) & 0x1F);
        byte hairstyle = (byte) (appearance[3] & 0x1F);
        byte campaign = (byte) ((appearance[3] >> 6) & 3);

        // extract the professions
        byte primary = (byte) ((appearance[2] >> 4) & 0xF);
        byte secondary = 0;

        // perform some unkown action...
        CharacterCreationView.unkownStep1(action.getChannel());

        Character chara = CharacterJpaController.get().findByName(characterName);
       
        // if name is in use ....
        if (chara != null)
        {
            CharacterCreationView.error(action.getChannel(), ErrorCode.CCNameInUse);
        }

        // if name is not in use create a new char in the db
        Character dbChar = new Character();
        dbChar.setName(characterName);
        dbChar.setAccountID(client.getAccount());
        dbChar.setSex((short)sex);
        dbChar.setHeight((short)height);
        dbChar.setHeight((short)skin);
        dbChar.setFace((short)face);
        dbChar.setHaircolor((short)haircolor);
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     */
    @Event.Handler
    public void onEntityCanSeeOther(CanSeeEvent canSee)
    {
        // check if this entity is a network client
        ClientBean client = clientRegistry.getObj(canSee.getThisEntity().getUuid());
        if (client == null) { return; }

        Entity et = canSee.getOtherEntity();

        EntitySpawningView.spawnAgent(client.getChannel(), et);
    }
View Full Code Here

Examples of gwlpr.mapshard.models.ClientBean

     */
    @Event.Handler
    public void onEntityLostSight(LostSightEvent lostSight)
    {
        // check if this entity is a network client
        ClientBean client = clientRegistry.getObj(lostSight.getThisEntity().getUuid());
        if (client == null) { return; }

        Entity et = lostSight.getOtherEntity();

        // send the despawn packets
        EntitySpawningView.despawnAgent(client.getChannel(), et);
    }
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.