getDatabaseID() public method

public getDatabaseID ( ) : int
return int
Ejemplo n.º 1
0
 public void sendCharacterData(Character p)
 {
     MessageOut msg=new MessageOut(Protocol.GAMSG_PLAYER_DATA);
     msg.writeInt32(p.getDatabaseID());
     p.serializeCharacterData(msg);
     send(msg);
 }
Ejemplo n.º 2
0
        public void addPendingCharacter(string token, Character ch)
        {
            /* First, check if the character is already on the map. This may happen if
               a client just lost its connection, and logged to the account server
               again, yet the game server has not yet detected the lost connection. */

            int id=ch.getDatabaseID();

            foreach(NetComputer client in clients)
            {
                GameClient c=(GameClient)client;

                Character old_ch=c.character;
                if(old_ch!=null&&old_ch.getDatabaseID()==id)
                {
                    if(c.status!=(int)AccountClientStatus.CLIENT_CONNECTED)
                    {
                        /* Either the server is confused, or the client is up to no
                           good. So ignore the request, and wait for the connections
                           to properly time out. */
                        return;
                    }

                    /* As the connection was not properly closed, the account server
                       has not yet updated its data, so ignore them. Instead, take the
                       already present character, kill its current connection, and make
                       it available for a new connection. */

                    //delete ch;
                    GameState.remove(old_ch);
                    kill(old_ch);
                    ch=old_ch;
                    break;
                }
            }

            // Mark the character as pending a connection.
            mTokenCollector.addPendingConnect(token, ch);
        }
Ejemplo n.º 3
0
        static void warp(Character ptr, MapComposite map, int x, int y)
        {
            //TODO DEBUG555 entfernen
            int debug=555;

            remove(ptr);
            ptr.setMap(map);
            ptr.setPosition(new Point(x, y));
            ptr.clearDestination();
            /* Force update of persistent data on map change, so that
               characters can respawn at the start of the map after a death or
               a disconnection. */
            Program.accountHandler.sendCharacterData(ptr);

            if(map.isActive())
            {
                if(!insert(ptr))
                {
                    ptr.disconnected();
                    Program.gameHandler.kill(ptr);
                }
            }
            else
            {
                MessageOut msg=new MessageOut(Protocol.GAMSG_REDIRECT);
                msg.writeInt32(ptr.getDatabaseID());
                Program.accountHandler.send(msg);
                Program.gameHandler.prepareServerChange(ptr);
            }
        }
Ejemplo n.º 4
0
 void updateCharacterVar(Character ch, string name, string value)
 {
     MessageOut msg=new MessageOut(Protocol.GAMSG_SET_VAR_CHR);
     msg.writeInt32(ch.getDatabaseID());
     msg.writeString(name);
     msg.writeString(value);
     send(msg);
 }
Ejemplo n.º 5
0
        void sendPost(Character c, MessageIn msg)
        {
            // send message to account server with id of sending player,
            // the id of receiving player, the letter receiver and contents, and attachments
            Logger.Write(LogLevel.Debug, "Sending GCMSG_STORE_POST.");
            MessageOut outmsg=new MessageOut(Protocol.GCMSG_STORE_POST);
            outmsg.writeInt32(c.getDatabaseID());
            outmsg.writeString(msg.readString()); // name of receiver
            outmsg.writeString(msg.readString()); // content of letter

            while(msg.getUnreadLength()>0) // attachments
            {
                // write the item id and amount for each attachment
                outmsg.writeInt32(msg.readInt16());
                outmsg.writeInt32(msg.readInt16());
            }

            send(outmsg);
        }
Ejemplo n.º 6
0
 void requestCharacterVar(Character ch, string name)
 {
     MessageOut msg=new MessageOut(Protocol.GAMSG_GET_VAR_CHR);
     msg.writeInt32(ch.getDatabaseID());
     msg.writeString(name);
     send(msg);
 }
Ejemplo n.º 7
0
        void getPost(Character c)
        {
            // let the postman know to expect some post for this character
            Program.postMan.addCharacter(c);

            // send message to account server with id of retrieving player
            Logger.Write(LogLevel.Debug, "Sending GCMSG_REQUEST_POST");
            MessageOut outmsg=new MessageOut(Protocol.GCMSG_REQUEST_POST);
            outmsg.writeInt32(c.getDatabaseID());
            send(outmsg);
        }
Ejemplo n.º 8
0
 void changeAccountLevel(Character c, int level)
 {
     MessageOut msg=new MessageOut(Protocol.GAMSG_CHANGE_ACCOUNT_LEVEL);
     msg.writeInt32(c.getDatabaseID());
     msg.writeInt16(level);
     send(msg);
 }
Ejemplo n.º 9
0
 void banCharacter(Character ch, int duration)
 {
     MessageOut msg=new MessageOut(Protocol.GAMSG_BAN_PLAYER);
     msg.writeInt32(ch.getDatabaseID());
     msg.writeInt32(duration);
     send(msg);
 }