本文整理汇总了C#中WorldServer.player.Player类的典型用法代码示例。如果您正苦于以下问题:C# Player类的具体用法?C# Player怎么用?C# Player使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Player类属于WorldServer.player命名空间,在下文中一共展示了Player类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:34,代码来源:CombatFormula.cs
示例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);
}
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:30,代码来源:SpawnObject.cs
示例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);
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:35,代码来源:MagicCombat.cs
示例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);
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:25,代码来源:FightCave.cs
示例5: Equipment
public Equipment(Player player)
{
for (int i = 0; i < slots.Length; i++) {
slots[i] = new Item(-1, 0);
}
this.player = player;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:7,代码来源:Equipment.cs
示例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;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:25,代码来源:ProtectedItems.cs
示例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);
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:27,代码来源:ProtectedItems.cs
示例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();
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:14,代码来源:WalkingQueue.cs
示例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());
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:8,代码来源:NPCInteract.cs
示例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;
}
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:56,代码来源:ItemInteract.cs
示例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.");
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:10,代码来源:FightCave.cs
示例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;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:10,代码来源:Barrows.cs
示例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;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:10,代码来源:FarmingPatches.cs
示例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;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:10,代码来源:CombatFormula.cs
示例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;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:11,代码来源:FarmingPatches.cs
示例16: interactWithAliMorissaae
public static void interactWithAliMorissaae(Player p, Npc n)
{
p.setEntityFocus(n.getClientIndex());
AreaEvent interactWithAliMorissaaeAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
interactWithAliMorissaaeAreaEvent.setAction(() => {
n.setFaceLocation(p.getLocation());
p.setFaceLocation(n.getLocation());
p.setEntityFocus(65535);
showAliDialogue(p, 205);
});
Server.registerCoordinateEvent(interactWithAliMorissaaeAreaEvent);
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:12,代码来源:AlKharid.cs
示例17: DwarfCannon
public DwarfCannon(Player player)
{
p = player;
cannonLocation = p.getLocation();
fakeCannonLocation = new Location(cannonLocation.getX()+1, cannonLocation.getY()+1, cannonLocation.getY());
firing = false;
cannonballs = 0;
constructionStage = 0;
direction = 0;
setNpcsInArea();
newCannon();
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:12,代码来源:DwarfCannon.cs
示例18: GroundItem
public GroundItem(int id, int amount, Location location, Player owner)
: base(id, amount)
{
this.location = location;
this.owner = owner;
respawn = false;
this.dropTime = Environment.TickCount;
if (owner != null)
{
ownerId = owner.getIndex();
}
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:12,代码来源:GroundItem.cs
示例19: AreaEvent
public AreaEvent(Player player, int x, int y, int x1, int y2)
: base(0)
{
this.p = player;
this.x = x;
this.y = y;
this.x1 = x1;
this.y2 = y2;
if (player != null)
{
player.setDistanceEvent(this);
}
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:13,代码来源:AreaEvent.cs
示例20: getProtectedItem2
public static int[] getProtectedItem2(Player p)
{
int[] protectedItem = new int[2];
protectedItem[0] = -1;
int[] protectedItem1 = getProtectedItem1(p);
bool save;
for (int i = 0; i < 28; i++) {
if (p.getInventory().getSlot(i).itemId == -1) continue;
int amt = p.getInventory().getItemAmount(p.getInventory().getItemInSlot(i));
int price = p.getInventory().getSlot(i).getDefinition().getPrice().getMaximumPrice();
if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
{
save = true;
if (protectedItem1[1] == INVENTORY) {
if (protectedItem1[0] == p.getInventory().getItemInSlot(i)) {
if (amt < 2) {
save = false;
}
}
}
if (save) {
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();
int amt = p.getEquipment().getAmountInSlot(equip);
if (price > ItemData.forId(protectedItem[0]).getPrice().getMaximumPrice())
{
save = true;
if (protectedItem1[1] == EQUIPMENT) {
if (protectedItem1[0] == p.getEquipment().getItemInSlot(equip))
{
if (amt < 2) {
save = false;
}
}
}
if (save) {
protectedItem[0] = p.getEquipment().getSlot(equip).getItemId();
protectedItem[1] = EQUIPMENT;
}
}
}
return protectedItem;
}
开发者ID:Krill156,项目名称:SharpEMU,代码行数:50,代码来源:ProtectedItems.cs
注:本文中的WorldServer.player.Player类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论