protected override void processMessage(NetComputer computer, MessageIn message)
{
GameClient client=(GameClient)computer;
if(client.status==(int)AccountClientStatus.CLIENT_LOGIN)
{
if(message.getId()!=Protocol.PGMSG_CONNECT)
return;
string magic_token=message.readString();
client.status=(int)AccountClientStatus.CLIENT_QUEUED; // Before the addPendingClient
mTokenCollector.addPendingClient(magic_token, client);
return;
}
else if(client.status!=(int)AccountClientStatus.CLIENT_CONNECTED)
{
return;
}
switch(message.getId())
{
case Protocol.PGMSG_SAY:
{
handleSay(client, message);
break;
}
case Protocol.PGMSG_NPC_TALK:
case Protocol.PGMSG_NPC_TALK_NEXT:
case Protocol.PGMSG_NPC_SELECT:
case Protocol.PGMSG_NPC_NUMBER:
case Protocol.PGMSG_NPC_STRING:
{
handleNpc(client, message);
break;
}
case Protocol.PGMSG_PICKUP:
{
handlePickup(client, message);
break;
}
case Protocol.PGMSG_USE_ITEM:
{
handleUseItem(client, message);
break;
}
case Protocol.PGMSG_DROP:
{
handleDrop(client, message);
break;
}
case Protocol.PGMSG_WALK:
{
handleWalk(client, message);
break;
}
case Protocol.PGMSG_EQUIP:
{
handleEquip(client, message);
break;
}
case Protocol.PGMSG_UNEQUIP:
{
handleUnequip(client, message);
break;
}
case Protocol.PGMSG_MOVE_ITEM:
{
handleMoveItem(client, message);
break;
}
case Protocol.PGMSG_ATTACK:
{
handleAttack(client, message);
break;
}
case Protocol.PGMSG_USE_SPECIAL:
{
handleUseSpecial(client, message);
break;
}
case Protocol.PGMSG_ACTION_CHANGE:
{
handleActionChange(client, message);
break;
}
case Protocol.PGMSG_DIRECTION_CHANGE:
{
handleDirectionChange(client, message);
break;
}
case Protocol.PGMSG_DISCONNECT:
{
handleDisconnect(client, message);
break;
}
case Protocol.PGMSG_TRADE_REQUEST:
{
handleTradeRequest(client, message);
break;
}
case Protocol.PGMSG_TRADE_CANCEL:
case Protocol.PGMSG_TRADE_AGREED:
case Protocol.PGMSG_TRADE_CONFIRM:
case Protocol.PGMSG_TRADE_ADD_ITEM:
case Protocol.PGMSG_TRADE_SET_MONEY:
{
handleTrade(client, message);
break;
}
case Protocol.PGMSG_NPC_BUYSELL:
{
handleNpcBuySell(client, message);
break;
}
case Protocol.PGMSG_RAISE_ATTRIBUTE:
{
handleRaiseAttribute(client, message);
break;
}
case Protocol.PGMSG_LOWER_ATTRIBUTE:
{
handleLowerAttribute(client, message);
break;
}
case Protocol.PGMSG_RESPAWN:
{
// plausibility check is done by character class
client.character.respawn();
break;
}
case Protocol.PGMSG_NPC_POST_SEND:
{
handleNpcPostSend(client, message);
break;
}
case Protocol.PGMSG_PARTY_INVITE:
{
handlePartyInvite(client, message);
break;
}
default:
{
Logger.Write(LogLevel.Warning, "Invalid message type");
client.send(new MessageOut(Protocol.XXMSG_INVALID));
break;
}
}
}