本文整理匯總了C#中RS2.Server.player.Player.setTrade方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.setTrade方法的具體用法?C# Player.setTrade怎麽用?C# Player.setTrade使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RS2.Server.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...");
}