Skip to content

Commit

Permalink
re-add warp specific map requester
Browse files Browse the repository at this point in the history
  • Loading branch information
sorokya committed Mar 27, 2022
1 parent 3c7929d commit 546fe80
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion EOLib/Net/FileTransfer/FileRequestActions.cs
Expand Up @@ -58,12 +58,18 @@ public bool NeedsMapForWarp(short mapID, byte[] mapRid, int fileSize)
return NeedMap(mapID, expectedChecksum, fileSize);
}

public async Task GetMapFromServer(short mapID, short sessionID)
public async Task GetMapForWarp(short mapID, short sessionID)
{
var mapFile = await _fileRequestService.RequestMapFileForWarp(mapID, sessionID);
SaveAndCacheMapFile(mapID, mapFile);
}

public async Task GetMapFromServer(short mapID, short sessionID)
{
var mapFile = await _fileRequestService.RequestMapFile(mapID, sessionID);
SaveAndCacheMapFile(mapID, mapFile);
}

public async Task GetItemFileFromServer(short sessionID)
{
var itemFile = await _fileRequestService.RequestFile<EIFRecord>(InitFileType.Item, sessionID);
Expand Down Expand Up @@ -145,6 +151,8 @@ public interface IFileRequestActions

bool NeedsMapForWarp(short mapID, byte[] mapRid, int fileSize);

Task GetMapForWarp(short mapID, short sessionID);

Task GetMapFromServer(short mapID, short sessionID);

Task GetItemFileFromServer(short sessionID);
Expand Down
2 changes: 1 addition & 1 deletion EOLib/PacketHandlers/BeginPlayerWarpHandler.cs
Expand Up @@ -72,7 +72,7 @@ public override bool HandlePacket(IPacket packet)
catch (IOException) { mapIsDownloaded = false; }

if (!mapIsDownloaded || _fileRequestActions.NeedsMapForWarp(mapID, mapRid, fileSize))
_fileRequestActions.GetMapFromServer(mapID, sessionID).Wait(5000);
_fileRequestActions.GetMapForWarp(mapID, sessionID).Wait(5000);

SendWarpAcceptToServer(mapID, sessionID);
break;
Expand Down

0 comments on commit 546fe80

Please sign in to comment.