本文整理汇总了C#中WorldServer.player.Player.isDead方法的典型用法代码示例。如果您正苦于以下问题:C# Player.isDead方法的具体用法?C# Player.isDead怎么用?C# Player.isDead使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.isDead方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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());
}
示例2: handleFifthClickNPC
private void handleFifthClickNPC(Player player, Packet packet)
{
int npcIndex = packet.readLEShort();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
Console.WriteLine("Fifth click NPC " + npc.getId());
SkillHandler.resetAllSkills(player);
if (Slayer.openPointsInterface(player, npc)) {
return;
}
}
示例3: handleItemOnItem
private void handleItemOnItem(Player player, Packet packet)
{
int itemSlot = packet.readUShort();
int unused = packet.readInt();
int withSlot = packet.readLEShort();
int unused2 = packet.readInt();
int itemUsed = packet.readLEShortA();
int usedWith = packet.readLEShortA();
if (itemSlot > 28 || itemSlot < 0 || withSlot > 28 || withSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
if (player.getInventory().getSlot(itemSlot).getItemId() == itemUsed && player.getInventory().getSlot(withSlot).getItemId() == usedWith) {
if (Fletching.isFletching(player, itemUsed, usedWith)) {
return;
} else if (Herblore.doingHerblore(player, itemUsed, usedWith)) {
return;
} else if (Herblore.mixDoses(player, itemUsed, usedWith, itemSlot, withSlot)) {
return;
} else if (Crafting.wantsToCraft(player, itemUsed, usedWith)) {
return;
} else if (Firemaking.isFiremaking(player, itemUsed, usedWith, itemSlot, withSlot)) {
return;
} else if (Farming.plantSapling(player, itemUsed, usedWith)) {
return;
} else {
player.getPackets().sendMessage("Nothing interesting happens.");
}
}
}
示例4: handleItemOnGroundItem
private void handleItemOnGroundItem(Player player, Packet packet)
{
int objectX = packet.readLEShortA();
int itemSlot = packet.readLEShort();
int itemIdInInventory = packet.readLEShort();
int itemIdOnGround = packet.readLEShort();
int objectY = packet.readLEShortA();
int interfaceId = packet.readLEShort();
int child = packet.readUShort();
if (itemSlot > 28 || itemSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
return;
if (Firemaking.isFiremaking(player, itemIdInInventory, itemIdOnGround, itemSlot, -1))
return;
else
player.getPackets().sendMessage("Nothing interesting happens.");
}
示例5: handleInvenClickItem
private void handleInvenClickItem(Player player, Packet packet)
{
int slot = packet.readLEShortA();
int item = packet.readShortA();
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
if (Consumables.isEating(player, player.getInventory().getItemInSlot(slot), slot))
return;
else if (Herblore.idHerb(player, player.getInventory().getItemInSlot(slot)))
return;
else if (RuneCraft.fillPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot)))
return;
else if (Prayer.wantToBury(player, player.getInventory().getItemInSlot(slot), slot))
return;
else if (Teleport.useTeletab(player, player.getInventory().getItemInSlot(slot), slot))
return;
else if (FarmingAmulet.showOptions(player, player.getInventory().getItemInSlot(slot)))
return;
switch(item) {
case 4155: // Slayer gem
Slayer.doDialogue(player, 1051);
break;
case 6: // Dwarf multicannon
if (player.getCannon() != null) {
player.getPackets().sendMessage("You already have a cannon set up!");
break;
}
player.setCannon(new DwarfCannon(player));
break;
case 5073: // Nest with seeds.
case 5074: // Nest with jewellery.
Woodcutting.randomNestItem(player, item);
break;
case 952: // Spade
player.setLastAnimation(new Animation(830));
if (Barrows.enterCrypt(player)) {
player.getPackets().sendMessage("You've broken into a crypt!");
break;
}
player.getPackets().sendMessage("You find nothing.");
break;
}
}
}
示例6: canCastSpell
private static bool canCastSpell(Player p, Entity target, int i, bool fakeNPC)
{
// fakeNPC is used to keep location when autocasting.
if (fakeNPC) {
return !p.isDead();
}
if (target.isDead() || p.isDead() || target.isDestroyed() || p.isDestroyed()) {
return false;
}
if (target is Npc) {
if (((Npc) target).getHp() <= 0) {
return false;
}
if (i == 47) {
p.getPackets().sendMessage("You cannot cast Teleblock upon an NPC.");
return false;
}
}
if ((target is Player) && (p is Player)) {
if (Location.inFightPits(target.getLocation()) && Location.inFightPits(target.getLocation()))
{
if (!Server.getMinigames().getFightPits().hasGameStarted()) {
return false;
}
return true;
}
if (p.getDuel() != null) {
if (((Player)target).getDuel() != null) {
if (p.getDuel().getPlayer2().Equals(((Player) target)) && ((Player) target).getDuel().getPlayer2().Equals(p)) {
if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_MAGIC)) {
p.getPackets().sendMessage("Magical combat has been disabled in this duel!");
return false;
}
if (p.getDuel().getStatus() == 6 && ((Player) target).getDuel().getStatus() == 6) {
return true;
}
}
}
p.getPackets().sendMessage("That isn't your opponent.");
return false;
}
if (i == 47) {
if (((Player)target).getTemporaryAttribute("teleblocked") != null) {
p.getPackets().sendMessage("That player already has a teleportation block upon them.");
return false;
}
}
if (!Location.inWilderness(target.getLocation())) {
p.getPackets().sendMessage("That player isn't in the wilderness.");
return false;
}
if (!Location.inWilderness(p.getLocation()))
{
p.getPackets().sendMessage("You aren't in the wilderness.");
return false;
}
int killerWildLevel = p.getLocation().wildernessLevel();
int targetWildLevel = ((Player)target).getLocation().wildernessLevel();
int killerCombatLevel = p.getSkills().getCombatLevel();
int targetCombatLevel = ((Player)target).getSkills().getCombatLevel();
int highest = killerCombatLevel > targetCombatLevel ? killerCombatLevel : targetCombatLevel;
int lowest = highest == killerCombatLevel ? targetCombatLevel : killerCombatLevel;
int difference = (highest - lowest);
if (difference > killerWildLevel || difference > targetWildLevel) {
((Player) p).getPackets().sendMessage("You must move deeper into the wilderness to attack that player.");
return false;
}
}
if (!Location.inMultiCombat(target.getLocation())) {
if (p.getAttacker() != null && !p.getAttacker().Equals(target)) {
p.getPackets().sendMessage("You are already in combat!");
return false;
}
if (target.getAttacker() != null && !target.getAttacker().Equals(p)) {
string type = target is Player ? "player" : "npc";
p.getPackets().sendMessage("That " + type + " is already in combat.");
return false;
}
}
if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < SPELL_LEVEL[i]) {
p.getPackets().sendMessage("You need a Magic level of " + SPELL_LEVEL[i] + " to cast that spell.");
return false;
}
if (!hasRunes(p, RUNES[i], RUNE_AMOUNTS[i])) {
p.getPackets().sendMessage("You do not have enough runes to cast that spell.");
return false;
}
if (NEEDS_STAFF[i]) {
if ((i != 38 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != STAFF[i]) || (i == 38 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != 8841 && p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) != STAFF[i]))
{
p.getPackets().sendMessage("You need to wield " + STAFF_NAME[i] + " to cast this spell.");
return false;
}
}
if (i == 37) {
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.CAPE) != 2412)
{
p.getPackets().sendMessage("You need to wear the Cape of Saradomin to be able to cast Saradomin Strike.");
return false;
}
//.........这里部分代码省略.........
示例7: handleSwapSlot2
private void handleSwapSlot2(Player player, Packet packet)
{
int interfaceId = packet.readLEShort();
int child = packet.readUShort();
int newSlot = packet.readLEShort();
int interface2 = packet.readUShort();
int child2 = packet.readUShort();
int oldSlot = packet.readLEShort();
int oldItem = player.getInventory().getItemInSlot(oldSlot);
int oldAmount = player.getInventory().getAmountInSlot(oldSlot);
int newItem = player.getInventory().getItemInSlot(newSlot);
int newAmount = player.getInventory().getAmountInSlot(newSlot);
if (oldSlot > 28 || oldSlot < 0 || newSlot > 28 || oldSlot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
switch (interfaceId) {
case 621: // Shop.
case 763: // Bank.
case 336: // Duel
player.getInventory().getSlot(oldSlot).setItemId(newItem);
player.getInventory().getSlot(oldSlot).setItemAmount(newAmount);
player.getInventory().getSlot(newSlot).setItemId(oldItem);
player.getInventory().getSlot(newSlot).setItemAmount(oldAmount);
break;
default:
misc.WriteError("UNHANDLED ITEM SWAP 2 : interface = " + interfaceId);
break;
}
//No need to update the screen since the client does it for us!
player.getPackets().refreshInventory();
}
示例8: handleRightClickTwo
private void handleRightClickTwo(Player player, Packet packet)
{
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int slot = packet.readLEShort();
int item = packet.readLEShort();
if (slot < 0 || slot > 28 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
switch(player.getInventory().getItemInSlot(slot)) {
case 5509: // Small pouch.
player.getPackets().sendMessage("There is " + player.getSmallPouchAmount() + " Pure essence in your small pouch. (holds 3).");
break;
case 5510: // Medium pouch.
player.getPackets().sendMessage("There is " + player.getMediumPouchAmount() + " Pure essence in your medium pouch. (holds 6).");
break;
case 5512: // Large pouch.
player.getPackets().sendMessage("There is " + player.getLargePouchAmount() + " Pure essence in your large pouch. (holds 9).");
break;
case 5514: // Giant pouch.
player.getPackets().sendMessage("There is " + player.getGiantPouchAmount() + " Pure essence in your giant pouch. (holds 12).");
break;
}
}
}
示例9: handlePickupItem
private void handlePickupItem(Player player, Packet packet)
{
int x = packet.readLEShort();
int id = packet.readUShort();
int y = packet.readLEShortA();
Location l = new Location(x, y, player.getLocation().getZ());
SkillHandler.resetAllSkills(player);
if (x < 1000 || y < 1000 | id < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
player.getPackets().closeInterfaces();
if(player.getLocation().Equals(l)) {
Server.getGroundItems().pickupItem(player, id, player.getLocation());
return;
}
CoordinateEvent pickupItemCoordinateEvent = new CoordinateEvent(player, l);
pickupItemCoordinateEvent.setAction(() => {
Server.getGroundItems().pickupItem(player, id, player.getLocation());
});
Server.registerCoordinateEvent(pickupItemCoordinateEvent);
}
示例10: handleThirdClickNPC
private void handleThirdClickNPC(Player player, Packet packet)
{
int npcIndex = packet.readShortA();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
Console.WriteLine("Third click NPC " + npc.getId());
SkillHandler.resetAllSkills(player);
if (Thieving.wantToThieveNpc(player, npc)) {
return;
} else if (Fishing.wantToFish(player, npc, true)) {
return;
} else if (AgilityArena.dialogue(player, npc, true)) {
return;
} else if (TzHaar.interactTzhaarNPC(player, npc, 2)) {
return;
} else if (WarriorGuild.talkToWarriorGuildNPC(player, npc, 2)) {
return;
}
switch(npc.getId()) {
case 553: // Aubury
HomeArea.interactWithAubury(player, npc, 2);
break;
case 519: // Bob
BrokenBarrows.talkToBob(player, npc, -1, 2);
break;
}
}
示例11: handleSecondClickNPC
private void handleSecondClickNPC(Player player, Packet packet)
{
int npcIndex = packet.readLEShort();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
Console.WriteLine("Second click NPC " + npc.getId());
SkillHandler.resetAllSkills(player);
if (Fishing.wantToFish(player, npc, false)) {
return;
} else if (Slayer.talkToMaster(player, npc)) {
return;
} else if (AgilityArena.dialogue(player, npc, false)) {
return;
} else if (TzHaar.interactTzhaarNPC(player, npc, 1)) {
return;
} else if (WarriorGuild.talkToWarriorGuildNPC(player, npc, 1)) {
return;
} else if (BoatOptions.interactWithBoatNPC(player, npc)) {
return;
}
switch(npc.getId()) {
case 519: // Bob
BrokenBarrows.talkToBob(player, npc, -1, 1);
break;
case 553: // Aubury
HomeArea.interactWithAubury(player, npc, 1);
break;
case 1862: // Ali morisanne
if (npc.getLocation().inArea(2319, 3177, 2321, 3182)) { // Home Ali
HomeArea.interactWithAliMorissaae(player, npc);
break;
} else if (npc.getLocation().inArea(3311, 3198, 3316, 3199)) { // Al Kharid Ali
AlKharid.interactWithAliMorissaae(player, npc);
break;
}
break;
}
}
示例12: handleMagicOnNPC
private void handleMagicOnNPC(Player player, Packet packet)
{
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int junk = packet.readShortA();
int npcIndex = packet.readLEShortA();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
SkillHandler.resetAllSkills(player);
player.setTarget(npc);
MagicCombat.newMagicAttack(player, npc, childId, interfaceId == 193);
Console.WriteLine(childId);
}
示例13: handleItemOnNPC
private void handleItemOnNPC(Player player, Packet packet)
{
int interfaceId = packet.readInt();
int slot = packet.readLEShort();
int npcIndex = packet.readLEShort();
int item = packet.readLEShortA();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
Console.WriteLine("Item on NPC " + npc.getId());
if (player.getInventory().getItemInSlot(slot) == item) {
switch(npc.getId()) {
case 519: // Bob
BrokenBarrows.talkToBob(player, npc, player.getInventory().getItemInSlot(slot), 0);
break;
}
}
}
示例14: handleFourthClickNPC
private void handleFourthClickNPC(Player player, Packet packet)
{
int npcIndex = packet.readUShort();
if (npcIndex < 0 || npcIndex > Constants.MAX_NPCS || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Npc npc = Server.getNpcList()[npcIndex];
if (npc == null || npc.isDestroyed()) {
return;
}
Console.WriteLine("Fourth click NPC " + npc.getId());
SkillHandler.resetAllSkills(player);
if (Slayer.openSlayerShop(player, npc)) {
return;
}
switch(npc.getId()) {
case 553: // Aubury
HomeArea.interactWithAubury(player, npc, 3);
break;
}
}
示例15: canCastSpell2
private static bool canCastSpell2(Player p, Entity target, int i, bool fakeNPC)
{
// fakeNPC is used to keep location when autocasting.
if (fakeNPC) {
return !p.isDead();
}
if (target.isDead() || p.isDead() || target.isDestroyed() || p.isDestroyed()) {
return false;
}
if (target is Npc) {
if (((Npc)target).getHp() <= 0)
{
return false;
}
}
if ((target is Player) && (p is Player)) {
if (Location.inFightPits(target.getLocation()) && Location.inFightPits(target.getLocation()))
{
if (!Server.getMinigames().getFightPits().hasGameStarted()) {
return false;
}
return true;
}
if (p.getDuel() != null) {
if (((Player)target).getDuel() != null) {
if (p.getDuel().getPlayer2().Equals(((Player) target)) && ((Player) target).getDuel().getPlayer2().Equals(p)) {
if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_MAGIC)) {
return false;
}
if (p.getDuel().getStatus() == 6 && ((Player) target).getDuel().getStatus() == 6) {
return true;
}
}
}
return false;
}
if (!Location.inWilderness(target.getLocation()) && !Location.inWilderness(p.getLocation()))
return false;
int killerWildLevel = p.getLocation().wildernessLevel();
int targetWildLevel = ((Player)target).getLocation().wildernessLevel();
int killerCombatLevel = p.getSkills().getCombatLevel();
int targetCombatLevel = ((Player)target).getSkills().getCombatLevel();
int highest = killerCombatLevel > targetCombatLevel ? killerCombatLevel : targetCombatLevel;
int lowest = highest == killerCombatLevel ? targetCombatLevel : killerCombatLevel;
int difference = (highest - lowest);
if (difference > killerWildLevel || difference > targetWildLevel) {
return false;
}
}
return true;
}