public void CreateMarker() { PlayerPerformAction p = new PlayerPerformAction(PacketTypes.SET); p.id = PlayerName; p.key = PassKey; p.ActionID = 0; StreamController.StreamWrite(NetHelpers.ConvertStructToBytes(p)); }
private bool ProcessPlayerAction(StreamWriter s, PacketTypes p, PlayerPerformAction pi) { switch (p) { case PacketTypes.SET: { WorldInterface.PerformAction(pi.id, pi.key, pi.ActionID); return(true); } } return(false); }
public bool ProcessPacket(StreamWriter s, PacketTypes p, DataTypes d, byte[] buff, ref int offset) { try { switch (d) { //Package the Region Data and Send it case DataTypes.REGION_INFO: { RegionInfo ri = NetHelpers.ConvertBytesToStruct <RegionInfo>(buff, ref offset); ProcessRegionInfo(s, p, ri); return(true); } case DataTypes.PLAYER_INFO: { PlayerInfo pi = NetHelpers.ConvertBytesToStruct <PlayerInfo>(buff, ref offset); ProcessPlayerInfo(s, p, pi); return(true); } case DataTypes.OBJECT_INFO: { ObjectInfo oi = NetHelpers.ConvertBytesToStruct <ObjectInfo>(buff, ref offset); ProcessObjectInfo(s, p, oi); return(true); } case DataTypes.PLAYER_CONTROL: { PlayerControl oi = NetHelpers.ConvertBytesToStruct <PlayerControl>(buff, ref offset); ProcessPlayerControl(s, p, oi); return(true); } case DataTypes.PLAYER_PERFORM_ACTION: { PlayerPerformAction oi = NetHelpers.ConvertBytesToStruct <PlayerPerformAction>(buff, ref offset); ProcessPlayerAction(s, p, oi); return(true); } default: return(false); } } catch { //Convert Bytes throws an exception if there isn't enough bytes to convert return(false); } }