本文整理汇总了C#中WorldServer.player.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于WorldServer.player命名空间,在下文中一共展示了Player类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: getMeleeDefence
public static double getMeleeDefence(Player p, Entity e)
{
if(e is Npc) {
return 0.0;
}
Player target = (Player) e;
int defBonus = getHighestDefBonus(target);
int defLevel = target.getSkills().getCurLevel(Skills.SKILL.DEFENCE);
double power = (defLevel + defBonus) * 0.0085; // was 0.0095
double amount = 1.160;
if (defBonus > 180) {
amount = 1.568;
} else if (defBonus > 290) {
amount = 2.480;
} else if (defBonus > 355) {
amount = 3.580;
}
power *= (defLevel * (power * 0.10)) + (defBonus * amount) * (power * 0.012);
if (target.getPrayers().getDefencePrayer() == 1) {
power *= 1.05;
} else if (target.getPrayers().getDefencePrayer() == 2) {
power *= 1.10;
} else if (target.getPrayers().getDefencePrayer() == 3) {
power *= 1.15;
} else if (target.getPrayers().getSuperPrayer() == 1) {
power *= 1.20;
} else if (target.getPrayers().getSuperPrayer() == 2) {
power *= 1.25;
}
if (wearingVerac(p)) {
power = (defLevel * 0.890);
}
return power;
}
示例2: execute
public void execute(Player player, string[] arguments)
{
//TODO: Possible TODO.
//I guess this command is for testing where object should be placed to spawnedObjects.cfg / objectLocations.cfg?
//Err I don't like this command too much as the objects spawned are fake..
//gotta maybe add to WorldObjects, like SpawnNPC :S later.
if (arguments.Length < 2)
{
player.getPackets().sendMessage("[SpawnObject command]: ::obj objectId face");
return;
}
int objectId = 0;
int face = 0;
if(!int.TryParse(arguments[0], out objectId)) {
player.getPackets().sendMessage("[SpawnObject command]: objectId is not a number ::obj objectId face");
return;
}
if(!int.TryParse(arguments[1], out face)) {
player.getPackets().sendMessage("[SpawnObject command]: face is not a number ::obj objectId face");
return;
}
foreach(Player p in Server.getPlayerList()) {
p.getPackets().createObject(objectId, player.getLocation(), face, 10);
}
}
示例3: castCharge
public static void castCharge(Player p)
{
p.removeTemporaryAttribute("autoCasting");
if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < 80) {
p.getPackets().sendMessage("You need a Magic level of 80 to cast Charge.");
return;
}
if (!hasRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT)) {
p.getPackets().sendMessage("You do not have enough runes to cast Charge.");
return;
}
if (p.getTemporaryAttribute("godCharged") != null) {
p.getPackets().sendMessage("You have already charged your god spells.");
return;
}
if (hasGodCapeAndStaff(p)) {
p.getPackets().sendMessage("You must wear a God cape and wield the matching staff to cast Charge.");
return;
}
if (!deleteRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT)) {
return;
}
p.setTemporaryAttribute("godCharged", true);
p.setLastGraphics(new Graphics(308, 800, 90));
p.setLastAnimation(new Animation(811));
p.getPackets().sendMessage("You feel charged with magical power..");
int delay = 60000 + misc.random(120000); //60 seconds + possible 120 seconds so, 1 minute to 2 minutes.
Event removeGodChargeEvent = new Event(delay);
removeGodChargeEvent.setAction(() => {
removeGodChargeEvent.stop();
p.removeTemporaryAttribute("godCharged");
p.getPackets().sendMessage("Your magical charge fades away.");
});
Server.registerEvent(removeGodChargeEvent);
}
示例4: 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);
}
示例5: Equipment
public Equipment(Player player)
{
for (int i = 0; i < slots.Length; i++) {
slots[i] = new Item(-1, 0);
}
this.player = player;
}
示例6: getProtectedItem1
public static int[] getProtectedItem1(Player p)
{
int[] protectedItem = new int[2];
protectedItem[0] = -1;
for (int i = 0; i < 28; i++) {
if(p.getInventory().getSlot(i).itemId == -1) continue;
int price = p.getInventory().getSlot(i).getDefinition().getPrice().getMaximumPrice();
if ((price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice()))
{
protectedItem[0] = p.getInventory().getSlot(i).getItemId();
protectedItem[1] = INVENTORY;
}
}
foreach (ItemData.EQUIP equip in Enum.GetValues(typeof(ItemData.EQUIP))) {
if (equip == ItemData.EQUIP.NOTHING) continue;
if (p.getEquipment().getSlot(equip).itemId == -1) continue;
int price = p.getEquipment().getSlot(equip).getDefinition().getPrice().getMaximumPrice();
if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
{
protectedItem[0] = p.getEquipment().getSlot(equip).getItemId();
protectedItem[1] = EQUIPMENT;
}
}
return protectedItem;
}
示例7: 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);
}
示例8: WalkingQueue
private int waypointWriteOffset = 0; //location where it can write next waypoint in array.
#endregion Fields
#region Constructors
public WalkingQueue(Player player)
{
this.player = player;
for(int i = 0; i < MAX_WALKING_WAYPOINTS; i++)
walkingQueue[i] = new Waypoint(0, 0, -1);
this.lastDirection = 6;
resetWalkingQueue();
}
示例9: handleExamineNPC
private void handleExamineNPC(Player player, Packet packet)
{
int npcId = packet.readUShort();
if (npcId < 0 || npcId > NpcData.getTotalNpcDefinitions() || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
return;
player.getPackets().sendMessage(NpcData.forId(npcId).getExamine());
}
示例10: handlePacket
public void handlePacket(Player player, Packet packet)
{
switch(packet.getPacketId()) {
case PacketHandlers.PacketId.EQUIP:
handleEquipItem(player, packet);
break;
case PacketHandlers.PacketId.ITEM_ON_ITEM:
handleItemOnItem(player, packet);
break;
case PacketHandlers.PacketId.INV_CLICK:
handleInvenClickItem(player, packet);
break;
case PacketHandlers.PacketId.ITEM_ON_OBJECT:
handleItemOnObject(player, packet);
break;
case PacketHandlers.PacketId.ITEM_ON_GROUND_ITEM:
handleItemOnGroundItem(player, packet);
break;
case PacketHandlers.PacketId.INV_OPERATE:
handleOperateItem(player, packet);
break;
case PacketHandlers.PacketId.INV_DROP:
handleDropItem(player, packet);
break;
case PacketHandlers.PacketId.PICKUP:
handlePickupItem(player, packet);
break;
case PacketHandlers.PacketId.INV_SWAP_SLOT:
handleSwapSlot(player, packet);
break;
case PacketHandlers.PacketId.INV_SWAP_SLOT2:
handleSwapSlot2(player, packet);
break;
case PacketHandlers.PacketId.INV_RIGHT_CLICK_OPTION1:
handleRightClickOne(player, packet);
break;
case PacketHandlers.PacketId.INV_RIGHT_CLICK_OPTION2:
handleRightClickTwo(player, packet);
break;
case PacketHandlers.PacketId.INV_EXAMINE_ITEM:
handleExamineItem(player, packet);
break;
}
}
示例11: antiTeleportMessage
public static void antiTeleportMessage(Player p)
{
p.getPackets().sendNPCHead(2617, 242, 1);
p.getPackets().modifyText("TzHaar-Mej-Jal", 242, 3);
p.getPackets().modifyText("I cannot allow you to teleport from the fight cave.", 242, 4);
p.getPackets().modifyText("In Tzhaar, you either win, or die!", 242, 5);
p.getPackets().animateInterface(9827, 242, 1);
p.getPackets().sendChatboxInterface2(242);
p.getPackets().sendMessage("You are unable to teleport from the fight cave.");
}
示例12: betweenDoors
public static bool betweenDoors(Player p)
{
for (int i = 0; i < DB.Length; i++) {
if (p.getLocation().inArea(DB[i][0], DB[i][1], DB[i][2], DB[i][3]))
{
return true;
}
}
return false;
}
示例13: getPatchesForPlayer
public Patch[] getPatchesForPlayer(Player p, int min, int max)
{
int i = 0;
Patch[] array = new Patch[4];
for (int j = min; j <= max; j++) {
Patch patch = patchExists(p, j);
array[i++] = patch;
}
return array;
}
示例14: getMagicHit
public static int getMagicHit(Player p, Entity target, int maxDamage)
{
double magicAttack = getMagicAttack(p);
double magicDefence = getMagicDefence(target);
if ((misc.randomDouble() * magicDefence) > (misc.randomDouble() * magicAttack))
{
return 0;
}
return maxDamage;
}
示例15: patchExists
public Patch patchExists(Player p, int index)
{
foreach(Patch patch in patches) {
if (patch.getOwnerName().Equals(p.getLoginDetails().getUsername())) {
if (patch.getPatchIndex() == index) {
return patch;
}
}
}
return null;
}