Package gwlpr.loginshard.models

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


        }
       
        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

    {
        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

TOP

Related Classes of gwlpr.loginshard.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.