本文整理匯總了C#中RS2.Server.player.Player類的典型用法代碼示例。如果您正苦於以下問題:C# Player類的具體用法?C# Player怎麽用?C# Player使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
Player類屬於RS2.Server.player命名空間,在下文中一共展示了Player類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: ShopSession
public ShopSession(Player p, int id)
{
this.player = p;
this.shopId = id;
this.shop = Server.getShopManager().getShop(id);
openShop();
}
示例2: execute
public void execute(Player player, string[] arguments)
{
player.getPackets().sendMessage("Spawning all possible objects please wait..");
for (int i = 0; i < 50000; i++)
player.getPackets().createObject(i, player.getLocation(), 0, 10);
player.getPackets().sendMessage("Dumping complete, now add dump to server.");
}
示例3: isEating
public static bool isEating(Player p, int item, int slot)
{
for (int i = 0; i < FOOD.Length; i++)
{
for (int j = 0; j < FOOD[i].Length; j++)
{
if (item == FOOD[i][j])
{
eatFood(p, i, j, slot);
return true;
}
}
}
for (int i = 0; i < POTIONS.Length; i++)
{
for (int j = 0; j < POTIONS[i].Length; j++)
{
if (item == POTIONS[i][j])
{
drinkPotion(p, i, j, slot);
return true;
}
}
}
return false;
}
示例4: useDoor
public bool useDoor(Player p, int doorId, int doorX, int doorY, int doorHeight)
{
Location doorLocation = new Location(doorX, doorY, doorHeight);
foreach (Door door in doors)
{
int id = door.isDoorOpen() ? door.getOpenDoorId() : door.getClosedDoorId();
if (id == doorId)
{
if (door.getDoorLocation().Equals(doorLocation))
{
if (door.isDoorOpen() && (Environment.TickCount - door.getLastChangeTime() <= PLAYER_CHANGE_DELAY))
{
// door was opened in the last PLAYER_CHANGE_DELAY ms..cant be instantly closed
return true;
}
else if (!door.isClosable() && door.isDoorOpen())
{
// door cannot be closed by a player
return true;
}
Door d = door;
AreaEvent useDoorAreaEvent = new AreaEvent(p, doorLocation.getX() - 1, doorLocation.getY() - 1, doorLocation.getX() + 1, doorLocation.getY() + 1);
useDoorAreaEvent.setAction(() =>
{
changeDoor(p, d);
});
Server.registerCoordinateEvent(useDoorAreaEvent);
return true;
}
}
}
return false;
}
示例5: removePlayingPlayer
public void removePlayingPlayer(Player p)
{
lock (playersPlaying)
{
playersPlaying.Remove(p);
}
}
示例6: dialogue
public static bool dialogue(Player p, Npc npc, bool rightClickPay)
{
if ((npc.getId() != 1055 && npc.getId() != 437) || (rightClickPay && npc.getId() != 437))
{
return false;
}
p.setEntityFocus(npc.getClientIndex());
AreaEvent dialogueAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
dialogueAreaEvent.setAction(() =>
{
npc.setFaceLocation(p.getLocation());
int status = npc.getId() == 1055 ? 43 : 1;
if (rightClickPay)
{
if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE))
{
p.getPackets().sendMessage("You don't have enough money to pay the entrance fee.");
return;
}
status = 29;
}
doDialogue(p, status);
});
Server.registerCoordinateEvent(dialogueAreaEvent);
return true;
}
示例7: addWaitingPlayer
public void addWaitingPlayer(Player p)
{
lock (playersWaiting)
{
playersWaiting.Add(p);
}
}
示例8: addPlayingPlayer
public void addPlayingPlayer(Player p)
{
lock (playersPlaying)
{
playersPlaying.Add(p);
}
}
示例9: addUser
public void addUser(Player p)
{
ClanUser user = new ClanUser(p, this);
if (p.getLoginDetails().getUsername().Equals(owner))
{
user.setClanRights(ClanRank.OWNER);
own = p;
}
if (ownerFriends.Contains(p.getLoginDetails().getLongName()))
{
if (user.getClanRights() == ClanRank.NO_RANK)
{
user.setClanRights(ClanRank.FRIEND);
}
}
foreach (KeyValuePair<string, ClanRank> u in usersWithRank)
{
if (u.Key.Equals(p.getLoginDetails().getUsername()))
{
user.setClanRights(u.Value);
break;
}
}
p.setClan(this);
lock (users)
{
users.Add(user);
}
}
示例10: getCryptIndex
public static int getCryptIndex(Player p)
{
if (p.getLocation().inArea(3567, 9701, 3580, 9711))
{
return VERAC;
}
else if (p.getLocation().inArea(3548, 9709, 3561, 9721))
{
return DHAROK;
}
else if (p.getLocation().inArea(3549, 9691, 3562, 9706))
{
return AHRIM;
}
else if (p.getLocation().inArea(3532, 9698, 3546, 9710))
{
return GUTHAN;
}
else if (p.getLocation().inArea(3544, 9677, 3559, 9689))
{
return KARIL;
}
else if (p.getLocation().inArea(3563, 9680, 3577, 9694))
{
return TORAG;
}
return -1;
}
示例11: interactWithAubury
public static void interactWithAubury(Player p, Npc n, int option)
{
p.setEntityFocus(n.getClientIndex());
AreaEvent interactWithAuburyAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
interactWithAuburyAreaEvent.setAction(() =>
{
n.setFaceLocation(p.getLocation());
p.setFaceLocation(n.getLocation());
p.setEntityFocus(65535);
switch (option)
{
case 1: // talk to
break;
case 2: // trade
p.setShopSession(new ShopSession(p, 3));
break;
case 3: // teleport
RuneCraft.teleportToEssMine(p, n);
break;
}
});
Server.registerCoordinateEvent(interactWithAuburyAreaEvent);
}
示例12: getMeleeAttack
public static double getMeleeAttack(Player p)
{
int attBonus = getHighestAttBonus(p);
int attLevel = p.getSkills().getCurLevel(Skills.SKILL.ATTACK);
double power = (attLevel + attBonus) * 0.01365;
double amount = 1.260;
power *= (attLevel * (power * 0.12)) + (attBonus * amount) * (power * 0.009);
if (p.getPrayers().getAttackPrayer() == 1)
{
power *= 1.05;
}
else if (p.getPrayers().getAttackPrayer() == 2)
{
power *= 1.10;
}
else if (p.getPrayers().getAttackPrayer() == 3 || p.getPrayers().getSuperPrayer() == 1)
{
power *= 1.15;
}
else if (p.getPrayers().getSuperPrayer() == 2)
{
power *= 1.20;
}
if (wearingMeleeVoid(p))
{
power *= 1.10;
}
return power;
}
示例13: enterCave
public static void enterCave(Player p)
{
AreaEvent enterCaveAreaEvent = new AreaEvent(p, 2438, 5168, 2439, 5168);
enterCaveAreaEvent.setAction(() =>
{
/*
* Fight cave is 20k squares from the original place, then another (200 * playerIndex) squares west.
*/
Location instanceLocation = new Location((20000 + 2413) + (200 * p.getIndex()), 20000 + 5116, 0);
p.teleport(instanceLocation);
p.setFightCave(new FightCaveSession(p));
Event caveNpcEvent = new Event(600);
caveNpcEvent.setAction(() =>
{
caveNpcEvent.stop();
p.getPackets().sendNPCHead(2617, 242, 1);
p.getPackets().modifyText("TzHaar-Mej-Jal", 242, 3);
p.getPackets().modifyText("You're on your own now, JalYt.", 242, 4);
p.getPackets().modifyText("Pepare to fight for your life!", 242, 5);
p.getPackets().animateInterface(9827, 242, 1);
p.getPackets().sendChatboxInterface2(242);
});
Server.registerEvent(caveNpcEvent);
});
Server.registerCoordinateEvent(enterCaveAreaEvent);
}
示例14: TradeSession
public TradeSession(Player player, Player player2)
{
this.player = player;
this.player2 = player2;
openTrade();
player.getTradeRequests().Clear();
}
示例15: displayItemsInterface
public static void displayItemsInterface(Player p)
{
int amountToKeep = p.isSkulled() ? 0 : 3;
if (p.getPrayers().isProtectItem())
{
amountToKeep = p.isSkulled() ? 1 : 4;
}
int item1 = getProtectedItem1(p)[0];
int item2 = getProtectedItem2(p)[0];
int item3 = getProtectedItem3(p)[0];
int item4 = amountToKeep == 4 ? getProtectedItem4(p)[0] : -1;
if (amountToKeep == 1)
{
item2 = 65535;
item3 = 65535;
item3 = item1;
}
if (amountToKeep == 0)
{
item1 = 65535;
item2 = 65535;
item3 = 65535;
item4 = 65535;
}
object[] opts = new object[] { 17598720, 20221838, "You're marked with a <col=ff3333>skull<col=ff981f>.", 0, 1, item4, item1, item2, item3, /* Items to keep */ amountToKeep /* Items to keep */, 0 };
p.getPackets().displayInterface(102);
p.getPackets().sendClientScript2(204, 118, opts, "iiooooiisii");
p.getPackets().setRightClickOptions(1278, (102 * 65536) + 21, 0, 40);
p.getPackets().setRightClickOptions(1278, (102 * 65536) + 18, 0, 4);
}