2016-06-12 20:12:59 +01:00
using FFXIVClassic.Common ;
2016-06-08 22:29:04 +01:00
using FFXIVClassic_Map_Server.packets ;
2015-09-25 18:52:25 -04:00
using System ;
using System.Collections.Generic ;
using System.IO ;
using System.Text ;
using FFXIVClassic_Map_Server.dataobjects ;
using FFXIVClassic_Map_Server.packets.receive ;
using FFXIVClassic_Map_Server.packets.send ;
using FFXIVClassic_Map_Server.packets.send.login ;
2015-10-06 23:53:14 -04:00
using FFXIVClassic_Map_Server.packets.send.actor ;
2015-12-04 23:39:18 -05:00
using FFXIVClassic_Map_Server.packets.send.supportdesk ;
2015-12-05 18:58:06 -05:00
using FFXIVClassic_Map_Server.packets.receive.social ;
using FFXIVClassic_Map_Server.packets.send.social ;
2015-12-06 20:23:34 -05:00
using FFXIVClassic_Map_Server.packets.receive.supportdesk ;
using FFXIVClassic_Map_Server.packets.receive.recruitment ;
using FFXIVClassic_Map_Server.packets.send.recruitment ;
2016-01-02 14:04:45 -05:00
using FFXIVClassic_Map_Server.packets.receive.events ;
using FFXIVClassic_Map_Server.lua ;
2016-01-24 17:11:35 -05:00
using FFXIVClassic_Map_Server.Actors ;
2015-09-25 18:52:25 -04:00
2016-06-08 22:29:04 +01:00
namespace FFXIVClassic_Map_Server
2015-09-25 18:52:25 -04:00
{
class PacketProcessor
{
2016-01-17 23:36:34 -05:00
Server mServer ;
2016-04-06 15:22:26 -07:00
CommandProcessor cp ;
2015-12-04 02:00:05 -05:00
Dictionary < uint , ConnectedPlayer > mPlayers ;
2015-09-25 18:52:25 -04:00
List < ClientConnection > mConnections ;
2016-01-17 23:36:34 -05:00
public PacketProcessor ( Server server , Dictionary < uint , ConnectedPlayer > playerList , List < ClientConnection > connectionList )
2015-09-25 18:52:25 -04:00
{
2015-10-04 22:43:22 -04:00
mPlayers = playerList ;
2015-09-25 18:52:25 -04:00
mConnections = connectionList ;
2016-01-17 23:36:34 -05:00
mServer = server ;
2016-04-06 15:22:26 -07:00
cp = new CommandProcessor ( playerList ) ;
2015-10-15 16:55:01 -04:00
}
2015-09-25 18:52:25 -04:00
2016-06-14 21:29:10 +01:00
public void ProcessPacket ( ClientConnection client , BasePacket packet )
2016-01-19 21:47:59 -05:00
{
2016-01-19 13:31:24 -05:00
if ( packet . header . isCompressed = = 0x01 )
2016-06-14 21:29:10 +01:00
BasePacket . DecryptPacket ( client . blowfish , ref packet ) ;
2015-09-25 18:52:25 -04:00
2016-06-14 21:29:10 +01:00
List < SubPacket > subPackets = packet . GetSubpackets ( ) ;
2015-09-25 18:52:25 -04:00
foreach ( SubPacket subpacket in subPackets )
{
2015-10-14 23:48:49 -04:00
if ( subpacket . header . type = = 0x01 )
2015-12-29 01:20:46 -05:00
{
2016-06-14 21:29:10 +01:00
packet . DebugPrintPacket ( ) ;
2015-12-29 01:20:46 -05:00
byte [ ] reply1Data = {
2016-04-05 17:34:34 -04:00
0x01 , 0x00 , 0x00 , 0x00 , 0x28 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x18 , 0x00 , 0x07 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x7F , 0xFD , 0xFF , 0xFF ,
0xE5 , 0x6E , 0x01 , 0xE0 , 0x00 , 0x00 , 0x00 , 0x0
} ;
byte [ ] reply2Data = {
0x01 , 0x00 , 0x00 , 0x00 , 0x28 , 0x00 , 0x01 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 ,
0x38 , 0x00 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x50 , 0x2B , 0x5F , 0x26 ,
0x66 , 0x00 , 0x00 , 0x00 , 0xC8 , 0xD6 , 0xAF , 0x2B , 0x38 , 0x2B , 0x5F , 0x26 , 0xB8 , 0x8D , 0xF0 , 0x2B ,
0xC8 , 0xFD , 0x85 , 0xFE , 0xA8 , 0x7C , 0x5B , 0x09 , 0x38 , 0x2B , 0x5F , 0x26 , 0xC8 , 0xD6 , 0xAF , 0x2B ,
0xB8 , 0x8D , 0xF0 , 0x2B , 0x88 , 0xAF , 0x5E , 0x26
2015-12-29 01:20:46 -05:00
} ;
BasePacket reply1 = new BasePacket ( reply1Data ) ;
2016-04-05 17:34:34 -04:00
BasePacket reply2 = new BasePacket ( reply2Data ) ;
2015-10-14 23:48:49 -04:00
2016-01-19 21:47:59 -05:00
//Write Timestamp into Reply1
2015-12-29 01:20:46 -05:00
using ( MemoryStream mem = new MemoryStream ( reply1 . data ) )
{
using ( BinaryWriter binReader = new BinaryWriter ( mem ) )
{
binReader . BaseStream . Seek ( 0x14 , SeekOrigin . Begin ) ;
binReader . Write ( ( UInt32 ) Utils . UnixTimeStampUTC ( ) ) ;
}
2016-01-19 21:47:59 -05:00
}
2015-10-14 23:48:49 -04:00
2016-01-19 21:47:59 -05:00
//Read in Actor Id that owns this connection
2015-10-14 23:48:49 -04:00
uint actorID = 0 ;
using ( MemoryStream mem = new MemoryStream ( packet . data ) )
{
using ( BinaryReader binReader = new BinaryReader ( mem ) )
2015-09-25 18:52:25 -04:00
{
2015-10-14 23:48:49 -04:00
try
2015-09-25 18:52:25 -04:00
{
2015-10-14 23:48:49 -04:00
byte [ ] readIn = new byte [ 12 ] ;
binReader . BaseStream . Seek ( 0x14 , SeekOrigin . Begin ) ;
binReader . Read ( readIn , 0 , 12 ) ;
actorID = UInt32 . Parse ( Encoding . ASCII . GetString ( readIn ) ) ;
2015-09-25 18:52:25 -04:00
}
2015-10-14 23:48:49 -04:00
catch ( Exception )
{ }
2015-09-25 18:52:25 -04:00
}
2015-10-14 23:48:49 -04:00
}
2015-09-25 18:52:25 -04:00
2016-01-19 21:47:59 -05:00
//Should never happen.... unless actor id IS 0!
2015-10-14 23:48:49 -04:00
if ( actorID = = 0 )
break ;
2016-01-19 21:47:59 -05:00
client . owner = actorID ;
2016-01-10 02:44:32 -05:00
2016-01-19 21:47:59 -05:00
//Write Actor ID into reply2
2015-10-14 23:48:49 -04:00
using ( MemoryStream mem = new MemoryStream ( reply2 . data ) )
{
using ( BinaryWriter binReader = new BinaryWriter ( mem ) )
2015-09-25 18:52:25 -04:00
{
2015-10-14 23:48:49 -04:00
binReader . BaseStream . Seek ( 0x10 , SeekOrigin . Begin ) ;
binReader . Write ( actorID ) ;
2015-09-25 18:52:25 -04:00
}
2015-10-14 23:48:49 -04:00
}
2015-09-25 18:52:25 -04:00
2016-01-19 21:47:59 -05:00
ConnectedPlayer player = null ;
if ( packet . header . connectionType = = BasePacket . TYPE_ZONE )
2015-10-14 23:48:49 -04:00
{
2016-06-24 20:52:30 +01:00
while ( mPlayers ! = null & & ! mPlayers . ContainsKey ( client . owner ) )
2016-01-19 21:47:59 -05:00
{ }
player = mPlayers [ client . owner ] ;
}
2016-06-14 21:29:10 +01:00
//Create connected player if not Created
2016-01-19 21:47:59 -05:00
if ( player = = null )
{
2015-12-04 02:00:05 -05:00
player = new ConnectedPlayer ( actorID ) ;
2015-10-14 23:48:49 -04:00
mPlayers [ actorID ] = player ;
}
2016-01-19 21:47:59 -05:00
2016-06-14 21:29:10 +01:00
player . SetConnection ( packet . header . connectionType , client ) ;
2016-01-19 21:47:59 -05:00
if ( packet . header . connectionType = = BasePacket . TYPE_ZONE )
2016-06-24 20:52:30 +01:00
Program . Log . Info ( "Got {0} connection for ActorID {1} @ {2}." , "zone" , actorID , client . GetAddress ( ) ) ;
2016-01-19 21:47:59 -05:00
else if ( packet . header . connectionType = = BasePacket . TYPE_CHAT )
2016-06-24 20:52:30 +01:00
Program . Log . Info ( "Got {0} connection for ActorID {1} @ {2}." , "chat" , actorID , client . GetAddress ( ) ) ;
2015-09-25 18:52:25 -04:00
2015-10-14 23:48:49 -04:00
//Create player actor
2016-06-14 21:29:10 +01:00
reply1 . DebugPrintPacket ( ) ;
client . QueuePacket ( reply1 ) ;
client . QueuePacket ( reply2 ) ;
2015-10-14 23:48:49 -04:00
break ;
}
2015-10-15 22:17:21 -04:00
else if ( subpacket . header . type = = 0x07 )
2015-10-14 23:48:49 -04:00
{
2016-06-24 20:52:30 +01:00
BasePacket init = Login0x7ResponsePacket . BuildPacket ( BitConverter . ToUInt32 ( packet . data , 0x10 ) , Utils . UnixTimeStampUTC ( ) , 0x08 ) ;
2016-06-14 21:29:10 +01:00
//client.QueuePacket(init);
2015-12-29 01:20:46 -05:00
}
else if ( subpacket . header . type = = 0x08 )
2016-06-24 20:52:30 +01:00
{
//Response, client's current [actorID][time]
//BasePacket init = Login0x7ResponsePacket.BuildPacket(BitConverter.ToUInt32(packet.data, 0x10), Utils.UnixTimeStampUTC(), 0x07);
//client.QueuePacket(init);
2016-06-14 21:29:10 +01:00
packet . DebugPrintPacket ( ) ;
2015-10-14 23:48:49 -04:00
}
else if ( subpacket . header . type = = 0x03 )
{
2016-02-18 22:38:54 -05:00
ConnectedPlayer player = null ;
if ( mPlayers . ContainsKey ( client . owner ) )
player = mPlayers [ client . owner ] ;
2016-06-24 20:52:30 +01:00
if ( player = = null | | ! player . IsClientConnectionsReady ( ) )
2016-02-18 22:38:54 -05:00
return ;
2016-01-19 21:47:59 -05:00
2015-12-29 01:20:46 -05:00
//Normal Game Opcode
2015-10-14 23:48:49 -04:00
switch ( subpacket . gameMessage . opcode )
2015-12-29 01:20:46 -05:00
{
2015-10-14 23:48:49 -04:00
//Ping
case 0x0001 :
2016-06-14 21:29:10 +01:00
//subpacket.DebugPrintSubPacket();
2015-10-14 23:48:49 -04:00
PingPacket pingPacket = new PingPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( PongPacket . BuildPacket ( player . actorID , pingPacket . time ) , true , false ) ) ;
player . Ping ( ) ;
2015-10-14 23:48:49 -04:00
break ;
//Unknown
2016-01-17 11:48:55 -05:00
case 0x0002 :
2016-06-14 21:29:10 +01:00
subpacket . DebugPrintSubPacket ( ) ;
client . QueuePacket ( _0x2Packet . BuildPacket ( player . actorID ) , true , false ) ;
2016-03-28 12:14:10 -04:00
2016-06-14 21:29:10 +01:00
Server . GetWorldManager ( ) . DoLogin ( player . GetActor ( ) ) ;
2016-01-16 23:03:04 -05:00
2015-10-14 23:48:49 -04:00
break ;
//Chat Received
case 0x0003 :
2015-12-29 01:20:46 -05:00
ChatMessagePacket chatMessage = new ChatMessagePacket ( subpacket . data ) ;
2016-06-14 05:09:30 +01:00
Program . Log . Info ( "Got type-{5} message: {0} @ {1}, {2}, {3}, Rot: {4}" , chatMessage . message , chatMessage . posX , chatMessage . posY , chatMessage . posZ , chatMessage . posRot , chatMessage . logType ) ;
2016-06-14 21:29:10 +01:00
subpacket . DebugPrintSubPacket ( ) ;
2016-02-18 22:38:54 -05:00
if ( chatMessage . message . StartsWith ( "!" ) )
{
2016-06-14 21:29:10 +01:00
if ( cp . DoCommand ( chatMessage . message , player ) )
2016-02-18 22:38:54 -05:00
continue ;
}
2016-01-23 23:28:12 -05:00
2016-06-14 21:29:10 +01:00
player . GetActor ( ) . BroadcastPacket ( SendMessagePacket . BuildPacket ( player . actorID , player . actorID , chatMessage . logType , player . GetActor ( ) . customDisplayName , chatMessage . message ) , false ) ;
2016-01-23 23:28:12 -05:00
2016-03-28 11:31:21 -04:00
break ;
//Langauge Code
case 0x0006 :
LangaugeCodePacket langCode = new LangaugeCodePacket ( subpacket . data ) ;
player . languageCode = langCode . languageCode ;
2015-10-14 23:48:49 -04:00
break ;
2016-03-28 21:00:33 -04:00
//Unknown - Happens a lot at login, then once every time player zones
2015-12-29 01:20:46 -05:00
case 0x0007 :
2016-06-14 21:29:10 +01:00
//subpacket.DebugPrintSubPacket();
2016-03-28 11:31:21 -04:00
_0x07Packet unknown07 = new _0x07Packet ( subpacket . data ) ;
2015-11-27 00:42:35 -05:00
break ;
2015-10-13 22:58:21 -04:00
//Update Position
2015-10-14 23:48:49 -04:00
case 0x00CA :
//Update Position
2016-06-14 21:29:10 +01:00
//subpacket.DebugPrintSubPacket();
2015-10-14 23:48:49 -04:00
UpdatePlayerPositionPacket posUpdate = new UpdatePlayerPositionPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
player . UpdatePlayerActorPosition ( posUpdate . x , posUpdate . y , posUpdate . z , posUpdate . rot , posUpdate . moveState ) ;
player . GetActor ( ) . SendInstanceUpdate ( ) ;
2016-03-28 11:31:21 -04:00
2016-06-14 21:29:10 +01:00
if ( player . GetActor ( ) . IsInZoneChange ( ) )
player . GetActor ( ) . SetZoneChanging ( false ) ;
2016-03-28 11:31:21 -04:00
2015-10-14 23:48:49 -04:00
break ;
//Set Target
case 0x00CD :
2016-06-14 21:29:10 +01:00
//subpacket.DebugPrintSubPacket();
2015-10-14 23:48:49 -04:00
SetTargetPacket setTarget = new SetTargetPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
player . GetActor ( ) . currentTarget = setTarget . actorID ;
player . GetActor ( ) . BroadcastPacket ( SetActorTargetAnimatedPacket . BuildPacket ( player . actorID , player . actorID , setTarget . actorID ) , true ) ;
2015-10-14 23:48:49 -04:00
break ;
//Lock Target
case 0x00CC :
LockTargetPacket lockTarget = new LockTargetPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
player . GetActor ( ) . currentLockedTarget = lockTarget . actorID ;
2015-10-14 23:48:49 -04:00
break ;
2016-01-02 14:04:45 -05:00
//Start Event
2016-02-07 13:05:54 -05:00
case 0x012D :
2016-06-14 21:29:10 +01:00
subpacket . DebugPrintSubPacket ( ) ;
2016-01-02 14:04:45 -05:00
EventStartPacket eventStart = new EventStartPacket ( subpacket . data ) ;
2016-02-07 13:05:54 -05:00
/ *
if ( eventStart . error ! = null )
{
player . errorMessage + = eventStart . error ;
if ( eventStart . errorIndex = = eventStart . errorNum - 1 )
2016-06-12 20:12:59 +01:00
Program . Log . Error ( "\n" + player . errorMessage ) ;
2016-02-07 13:05:54 -05:00
break ;
}
* /
2016-01-02 14:04:45 -05:00
2016-06-14 21:29:10 +01:00
Actor ownerActor = Server . GetStaticActors ( eventStart . scriptOwnerActorID ) ;
2016-06-18 12:26:29 -04:00
2016-06-19 18:52:34 -04:00
player . GetActor ( ) . currentEventOwner = eventStart . scriptOwnerActorID ;
player . GetActor ( ) . currentEventName = eventStart . triggerName ;
2016-04-14 08:30:21 -04:00
2016-01-24 17:11:35 -05:00
if ( ownerActor = = null )
2016-01-28 23:24:20 -05:00
{
2016-03-28 11:31:21 -04:00
//Is it a instance actor?
2016-06-14 21:29:10 +01:00
ownerActor = Server . GetWorldManager ( ) . GetActorInWorld ( player . GetActor ( ) . currentEventOwner ) ;
2016-01-28 23:24:20 -05:00
if ( ownerActor = = null )
2016-02-07 13:05:54 -05:00
{
2016-03-28 11:31:21 -04:00
//Is it a Director?
2016-06-14 21:29:10 +01:00
if ( player . GetActor ( ) . currentDirector ! = null & & player . GetActor ( ) . currentEventOwner = = player . GetActor ( ) . currentDirector . actorId )
ownerActor = player . GetActor ( ) . currentDirector ;
2016-03-28 11:31:21 -04:00
else
{
2016-06-14 21:29:10 +01:00
Program . Log . Debug ( "\n===Event START===\nCould not find actor 0x{0:X} for event started by caller: 0x{1:X}\nEvent Starter: {2}\nParams: {3}" , eventStart . actorID , eventStart . scriptOwnerActorID , eventStart . triggerName , LuaUtils . DumpParams ( eventStart . luaParams ) ) ;
2016-03-28 11:31:21 -04:00
break ;
}
2016-02-07 13:05:54 -05:00
}
2016-01-28 23:24:20 -05:00
}
2016-06-17 23:17:24 -04:00
player . GetActor ( ) . StartEvent ( ownerActor , eventStart ) ;
2016-01-02 14:04:45 -05:00
2016-06-14 21:29:10 +01:00
Program . Log . Debug ( "\n===Event START===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nEvent Starter: {4}\nParams: {5}" , eventStart . actorID , eventStart . scriptOwnerActorID , eventStart . val1 , eventStart . val2 , eventStart . triggerName , LuaUtils . DumpParams ( eventStart . luaParams ) ) ;
2015-10-14 23:48:49 -04:00
break ;
2016-03-28 11:31:21 -04:00
//Unknown, happens at npc spawn and cutscene play????
case 0x00CE :
break ;
2016-01-02 14:04:45 -05:00
//Event Result
2015-10-14 23:48:49 -04:00
case 0x012E :
2016-06-14 21:29:10 +01:00
subpacket . DebugPrintSubPacket ( ) ;
2016-01-02 14:04:45 -05:00
EventUpdatePacket eventUpdate = new EventUpdatePacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
Program . Log . Debug ( "\n===Event UPDATE===\nSource Actor: 0x{0:X}\nCaller Actor: 0x{1:X}\nVal1: 0x{2:X}\nVal2: 0x{3:X}\nStep: 0x{4:X}\nParams: {5}" , eventUpdate . actorID , eventUpdate . scriptOwnerActorID , eventUpdate . val1 , eventUpdate . val2 , eventUpdate . step , LuaUtils . DumpParams ( eventUpdate . luaParams ) ) ;
2016-06-17 23:17:24 -04:00
/ *
2016-01-28 23:24:20 -05:00
//Is it a static actor? If not look in the player's instance
2016-06-14 21:29:10 +01:00
Actor updateOwnerActor = Server . GetStaticActors ( player . GetActor ( ) . currentEventOwner ) ;
2016-01-02 14:04:45 -05:00
if ( updateOwnerActor = = null )
2016-01-28 23:24:20 -05:00
{
2016-06-14 21:29:10 +01:00
updateOwnerActor = Server . GetWorldManager ( ) . GetActorInWorld ( player . GetActor ( ) . currentEventOwner ) ;
2016-04-01 23:24:14 -04:00
2016-06-14 21:29:10 +01:00
if ( player . GetActor ( ) . currentDirector ! = null & & player . GetActor ( ) . currentEventOwner = = player . GetActor ( ) . currentDirector . actorId )
updateOwnerActor = player . GetActor ( ) . currentDirector ;
2016-04-01 23:24:14 -04:00
2016-01-28 23:24:20 -05:00
if ( updateOwnerActor = = null )
break ;
}
2016-06-17 23:17:24 -04:00
* /
player . GetActor ( ) . UpdateEvent ( eventUpdate ) ;
2016-01-02 14:04:45 -05:00
2016-06-17 23:17:24 -04:00
//LuaEngine.DoActorOnEventUpdated(player.GetActor(), updateOwnerActor, eventUpdate);
2016-01-24 17:11:35 -05:00
2015-10-14 23:48:49 -04:00
break ;
case 0x012F :
2016-07-17 09:21:17 -04:00
//subpacket.DebugPrintSubPacket();
2016-03-19 18:43:02 -04:00
ParameterDataRequestPacket paramRequest = new ParameterDataRequestPacket ( subpacket . data ) ;
if ( paramRequest . paramName . Equals ( "charaWork/exp" ) )
2016-06-14 21:29:10 +01:00
player . GetActor ( ) . SendCharaExpInfo ( ) ;
2015-12-04 23:39:18 -05:00
break ;
2015-12-29 01:20:46 -05:00
/* RECRUITMENT */
2015-12-06 20:23:34 -05:00
//Start Recruiting
case 0x01C3 :
StartRecruitingRequestPacket recruitRequestPacket = new StartRecruitingRequestPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( StartRecruitingResponse . BuildPacket ( player . actorID , true ) , true , false ) ) ;
2015-12-06 20:23:34 -05:00
break ;
2015-12-06 22:58:42 -05:00
//End Recruiting
case 0x01C4 :
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( EndRecruitmentPacket . BuildPacket ( player . actorID ) , true , false ) ) ;
2015-12-06 22:58:42 -05:00
break ;
//Party Window Opened, Request State
case 0x01C5 :
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( RecruiterStatePacket . BuildPacket ( player . actorID , true , true , 1 ) , true , false ) ) ;
2015-12-06 22:58:42 -05:00
break ;
//Search Recruiting
2015-12-06 20:23:34 -05:00
case 0x01C7 :
2015-12-29 01:20:46 -05:00
RecruitmentSearchRequestPacket recruitSearchPacket = new RecruitmentSearchRequestPacket ( subpacket . data ) ;
2015-12-06 20:23:34 -05:00
break ;
2015-12-06 22:58:42 -05:00
//Get Recruitment Details
2015-12-06 20:23:34 -05:00
case 0x01C8 :
2015-12-06 22:58:42 -05:00
RecruitmentDetailsRequestPacket currentRecruitDetailsPacket = new RecruitmentDetailsRequestPacket ( subpacket . data ) ;
2015-12-06 20:23:34 -05:00
RecruitmentDetails details = new RecruitmentDetails ( ) ;
details . recruiterName = "Localhost Character" ;
details . purposeId = 2 ;
details . locationId = 1 ;
details . subTaskId = 1 ;
2016-06-14 21:29:10 +01:00
details . comment = "This is a test details packet sent by the server. No implementation has been Created yet..." ;
2015-12-06 20:23:34 -05:00
details . num [ 0 ] = 1 ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( CurrentRecruitmentDetailsPacket . BuildPacket ( player . actorID , details ) , true , false ) ) ;
2015-12-06 20:23:34 -05:00
break ;
2015-12-06 22:58:42 -05:00
//Accepted Recruiting
2015-12-06 20:23:34 -05:00
case 0x01C6 :
2016-06-14 21:29:10 +01:00
subpacket . DebugPrintSubPacket ( ) ;
2015-12-29 01:20:46 -05:00
break ;
2015-12-05 18:58:06 -05:00
/* SOCIAL STUFF */
case 0x01C9 :
AddRemoveSocialPacket addBlackList = new AddRemoveSocialPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( BlacklistAddedPacket . BuildPacket ( player . actorID , true , addBlackList . name ) , true , false ) ) ;
2015-12-05 18:58:06 -05:00
break ;
case 0x01CA :
2016-06-14 22:54:02 +01:00
AddRemoveSocialPacket RemoveBlackList = new AddRemoveSocialPacket ( subpacket . data ) ;
client . QueuePacket ( BasePacket . CreatePacket ( BlacklistRemovedPacket . BuildPacket ( player . actorID , true , RemoveBlackList . name ) , true , false ) ) ;
2015-12-05 18:58:06 -05:00
break ;
2015-12-13 22:19:39 -05:00
case 0x01CB :
int offset1 = 0 ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( SendBlacklistPacket . BuildPacket ( player . actorID , new String [ ] { "Test" } , ref offset1 ) , true , false ) ) ;
2015-12-13 22:19:39 -05:00
break ;
2015-12-05 18:58:06 -05:00
case 0x01CC :
AddRemoveSocialPacket addFriendList = new AddRemoveSocialPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( FriendlistAddedPacket . BuildPacket ( player . actorID , true , ( uint ) addFriendList . name . GetHashCode ( ) , true , addFriendList . name ) , true , false ) ) ;
2015-12-05 18:58:06 -05:00
break ;
case 0x01CD :
2016-06-14 22:54:02 +01:00
AddRemoveSocialPacket RemoveFriendList = new AddRemoveSocialPacket ( subpacket . data ) ;
client . QueuePacket ( BasePacket . CreatePacket ( FriendlistRemovedPacket . BuildPacket ( player . actorID , true , RemoveFriendList . name ) , true , false ) ) ;
2015-12-05 18:58:06 -05:00
break ;
2015-12-13 22:19:39 -05:00
case 0x01CE :
int offset2 = 0 ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( SendFriendlistPacket . BuildPacket ( player . actorID , new Tuple < long , string > [ ] { new Tuple < long , string > ( 01 , "Test2" ) } , ref offset2 ) , true , false ) ) ;
2015-12-13 22:19:39 -05:00
break ;
2015-12-05 18:58:06 -05:00
case 0x01CF :
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( FriendStatusPacket . BuildPacket ( player . actorID , null ) , true , false ) ) ;
2015-12-05 18:58:06 -05:00
break ;
2015-12-04 23:39:18 -05:00
/* SUPPORT DESK STUFF */
//Request for FAQ/Info List
2015-12-06 20:23:34 -05:00
case 0x01D0 :
FaqListRequestPacket faqRequest = new FaqListRequestPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( FaqListResponsePacket . BuildPacket ( player . actorID , new string [ ] { "Testing FAQ1" , "Coded style!" } ) , true , false ) ) ;
2015-12-04 23:39:18 -05:00
break ;
//Request for body of a faq/info selection
case 0x01D1 :
2015-12-06 20:23:34 -05:00
FaqBodyRequestPacket faqBodyRequest = new FaqBodyRequestPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( FaqBodyResponsePacket . BuildPacket ( player . actorID , "HERE IS A GIANT BODY. Nothing else to say!" ) , true , false ) ) ;
2015-12-04 23:39:18 -05:00
break ;
//Request issue list
case 0x01D2 :
2015-12-06 20:23:34 -05:00
GMTicketIssuesRequestPacket issuesRequest = new GMTicketIssuesRequestPacket ( subpacket . data ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( IssueListResponsePacket . BuildPacket ( player . actorID , new string [ ] { "Test1" , "Test2" , "Test3" , "Test4" , "Test5" } ) , true , false ) ) ;
2015-12-04 23:39:18 -05:00
break ;
2015-12-13 22:19:39 -05:00
//Request if GM ticket exists
case 0x01D3 :
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( StartGMTicketPacket . BuildPacket ( player . actorID , false ) , true , false ) ) ;
2015-12-13 22:19:39 -05:00
break ;
2015-12-04 23:39:18 -05:00
//Request for GM response message
case 0x01D4 :
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( GMTicketPacket . BuildPacket ( player . actorID , "This is a GM Ticket Title" , "This is a GM Ticket Body." ) , true , false ) ) ;
2015-12-04 23:39:18 -05:00
break ;
2016-02-16 22:53:53 -05:00
//GM Ticket Sent
case 0x01D5 :
GMSupportTicketPacket gmTicket = new GMSupportTicketPacket ( subpacket . data ) ;
2016-06-12 20:12:59 +01:00
Program . Log . Info ( "Got GM Ticket: \n" + gmTicket . ticketTitle + "\n" + gmTicket . ticketBody ) ;
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( GMTicketSentResponsePacket . BuildPacket ( player . actorID , true ) , true , false ) ) ;
2016-02-16 22:53:53 -05:00
break ;
2015-12-04 23:39:18 -05:00
//Request to end ticket
case 0x01D6 :
2016-06-14 21:29:10 +01:00
client . QueuePacket ( BasePacket . CreatePacket ( EndGMTicketPacket . BuildPacket ( player . actorID ) , true , false ) ) ;
2015-10-14 23:48:49 -04:00
break ;
default :
2016-06-14 05:09:30 +01:00
Program . Log . Debug ( "Unknown command 0x{0:X} received." , subpacket . gameMessage . opcode ) ;
2016-06-14 21:29:10 +01:00
subpacket . DebugPrintSubPacket ( ) ;
2015-10-14 23:48:49 -04:00
break ;
}
2015-09-25 18:52:25 -04:00
}
2015-12-29 01:20:46 -05:00
else
2016-06-14 21:29:10 +01:00
packet . DebugPrintPacket ( ) ;
2015-09-25 18:52:25 -04:00
}
2015-11-27 00:42:35 -05:00
}
2015-10-04 22:43:22 -04:00
2015-09-25 18:52:25 -04:00
}
}