Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated Marketplace Recall #169

Closed

Conversation

LtRipley36706
Copy link
Member

@mp command better reflects how it worked in AC1Live.

The movement check/cancel is not yet implemented.

// TODO: check current position of player against recorded position at time of command issuance, if they don't match, send the you've moved too far error (and thunk sound?).
// Enum_0498 of StatusMessageType1 ??
// Not sure what kind of tolerance there was with this check in respect to how far from initial start point one could move..
Session.Player.Teleport(new Position(23855548, 49.206f, -31.935f, 0.005f, 0f, 0f, -0.7071068f, 0.7071068f));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should still be a static position somewhere. For lack of a better place, static values inside the Position class itself is a good place. Also, you're already in the Player object so no need to do Session.Player. Ideally, this line would be:
Teleport(Position.Marketplace);

@@ -14,7 +14,7 @@ public class GameActionTeleToMarketPlace : GameActionPacket
public GameActionTeleToMarketPlace(Session session, ClientPacketFragment fragment) : base(session, fragment) { }

// TODO: link to Town Network marketplace portal destination in db, when db for that is finalized and implemented.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean up commented out code. We have history in git.

@@ -110,6 +112,12 @@ public void Update(double lastTick)
SendFinalLogOffMessages();
}

if (marketplaceRequestTime != DateTime.MinValue && marketplaceRequestTime.AddSeconds(14) <= DateTime.UtcNow)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a number of things for which a player has to wait for a timer. Allegiance Recall, House Recall, Lifestone Recall, Marketplace, whatever. It feels like the best solution is to use a generic Timer that does the work instead of one that's ultra-specific to "marketplaceRequestTime". Also, the "end" time should be set upon receipt of the command, not calculated every game loop.

For example:
in Handle, you'd call this method of the player

Session.Player.SetTimedTeleport(Timespan delay, Position destination)
{
    delayedTeleportDestination = destination;
    waitingForDelayedTeleport = true;
    timeToTeleport = DateTime.UtcNow + delay;
}

Also remember, you'd then need to have Autonomous updates to the player's position cancel the timed teleport.

    waitingForDelayedTeleport = false;
    delayedTeleportDestination = null;

The Session Update would then do something like the following:

if (WaitingForDelayedTeleport && DateTime.UtcNow > Player.TimeToTeleport)
{
    Player.WaitingForDelayedTeleport = false;
    Player.Teleport(Player.DelayedTeleportDestination);
}

@LtRipley36706
Copy link
Member Author

See #223

@LtRipley36706 LtRipley36706 deleted the updateMarketplaceRecall branch April 21, 2017 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants