本文整理汇总了C#中RunescapeServer.player.Player.setTrade方法的典型用法代码示例。如果您正苦于以下问题:C# Player.setTrade方法的具体用法?C# Player.setTrade怎么用?C# Player.setTrade使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RunescapeServer.player.Player
的用法示例。
在下文中一共展示了Player.setTrade方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: unregister
/**
* Unregister a player.
* @param p as Player
*/
public static void unregister(Player p)
{
if (p.getTrade() != null)
{
p.getTrade().decline();
p.setTrade(null);
}
minigames.getFightPits().removeWaitingPlayer(p);
minigames.getFightPits().removePlayingPlayer(p);
if (p.getTemporaryAttribute("cantDoAnything") != null && Location.inFightPits(p.getLocation()))
{
minigames.getFightPits().useOrb(p, 5);
return;
}
if (Location.inFightPits(p.getLocation()))
{
Server.getMinigames().getFightPits().teleportToWaitingRoom(p, false);
return;
}
if (p.getFightCave() != null)
{
if (!p.getFightCave().isGamePaused())
{
p.getFightCave().teleFromCave(true);
return;
}
else
{
p.setLocation(new Location(2439, 5169, 0));
}
}
if (!Combat.isXSecondsSinceCombat(p, p.getLastAttacked(), 10000) || p.isDead() || p.getTemporaryAttribute("unmovable") != null)
{
return;
}
if (p.getDuel() != null)
{
if (p.getDuel().getStatus() == 8)
{
if (p.getDuel().getWinner().Equals(p))
{
p.getDuel().recieveWinnings(p);
}
}
else
{
if (p.getDuel().getStatus() == 5 || p.getDuel().getStatus() == 6)
{
p.getDuel().finishDuel(true, true);
}
}
}
removeAllPlayersNPCs(p);
foreach(Player p2 in players) {
if(p == p2) continue;
//Remove me from anyone who has Seen me.. or attempting to see me (new players).
if (p2.getLocalEnvironment().getSeenPlayers().Contains(p) || p2.getLocalEnvironment().getNewPlayers().Contains(p))
p2.getLocalEnvironment().getRemovedPlayers().Add(p);
}
clanManager.leaveChannel(p);
loginHandler.addSavePlayer(p);
players.Remove(p);
p.getFriends().unregistered();
Console.WriteLine("Unregistered " + p.getLoginDetails().getUsername() + " [online = " + players.Count + "]");
}
示例2: handleTradePlayer
private void handleTradePlayer(Player player, Packet packet) {
int index = packet.readLEShortA();
if(index < 0 || index >= Constants.MAX_PLAYERS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
Player p2 = Server.getPlayerList()[index];
if (p2 == null) {
return;
}
player.setFaceLocation(p2.getLocation());
if(player.getTrade() != null) {
player.getTrade().decline();
return;
}
player.getPackets().closeInterfaces();
if (!player.getLocation().withinDistance(p2.getLocation(), 1)) {
int x = p2.getLocation().getX();
int y = p2.getLocation().getY();
AreaEvent tradePlayerAreaEvent = new AreaEvent(player, x-1, y-1, x+1, y+1);
tradePlayerAreaEvent.setAction(() => {
player.getWalkingQueue().resetWalkingQueue();
player.getPackets().clearMapFlag();
if (p2.getGESession() != null || p2.getTrade() != null || p2.getDuel() != null || p2.getShopSession() != null || p2.getBank().isBanking()) {
player.getPackets().sendMessage("That player is busy at the moment.");
return;
}
if (p2.wantsToTrade(player)) {
player.getPackets().closeInterfaces();
p2.getPackets().closeInterfaces();
p2.setFaceLocation(player.getLocation());
player.setTrade(new TradeSession(player, p2));
p2.setTrade(new TradeSession(p2, player));
return;
}
player.setFaceLocation(p2.getLocation());
p2.getPackets().sendMessage(player.getLoginDetails().getUsername() + ":tradereq:");
player.getPackets().sendMessage("Sending trade offer...");
player.newTradeRequest(p2);
});
Server.registerCoordinateEvent(tradePlayerAreaEvent);
return;
}
if (p2.getGESession() != null || p2.getTrade() != null || p2.getDuel() != null || p2.getShopSession() != null || p2.getBank().isBanking()) {
player.getPackets().sendMessage("That player is busy at the moment.");
return;
}
if (p2.wantsToTrade(player)) {
player.getPackets().closeInterfaces();
p2.getPackets().closeInterfaces();
p2.setFaceLocation(player.getLocation());
player.setTrade(new TradeSession(player, p2));
p2.setTrade(new TradeSession(p2, player));
return;
}
player.newTradeRequest(p2);
p2.getPackets().sendMessage(player.getLoginDetails().getUsername() + ":tradereq:");
player.getPackets().sendMessage("Sending trade offer...");
}