本文整理匯總了C#中RS2.Server.player.Player.isDead方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.isDead方法的具體用法?C# Player.isDead怎麽用?C# Player.isDead使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RS2.Server.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: handleClickOne
private void handleClickOne(Player player, Packet packet)
{
int slot = packet.readShortA();
int item = packet.readUShort();
int childId = packet.readUShort();
int interfaceId = packet.readUShort();
if (slot < 0 || slot > 28 || player.isDead())
{
return;
}
Console.WriteLine("Click One Slot = " + slot);
player.getPackets().closeInterfaces();
Console.WriteLine("InterfaceOption 1: interfaceId: " + interfaceId);
switch (interfaceId)
{
case 387: // Unequip item
if (slot < 14 && player.getEquipment().getItemInSlot((ItemData.EQUIP)slot) == item)
{
player.getEquipment().unequipItem((ItemData.EQUIP)slot);
}
break;
}
}
示例4: drinkPotion
private static void drinkPotion(Player p, int i, int j, int slot)
{
//TODO antipoisons/antifire
int lastPotion = -1;
int delay = 500;
long lastDrink = 0;
if (p.isDead() || p.getTemporaryAttribute("willDie") != null)
{
return;
}
if (p.getDuel() != null)
{
if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_DRINKS))
{
p.getPackets().sendMessage("Drinks have been disabled for this duel!");
return;
}
}
if (p.getTemporaryAttribute("lastDrankPotion") != null)
{
lastPotion = (int)p.getTemporaryAttribute("lastDrankPotion");
}
if (p.getTemporaryAttribute("drinkPotionTimer") != null)
{
lastDrink = (int)p.getTemporaryAttribute("drinkPotionTimer");
}
int time = (j == lastPotion) ? 1000 : 500;
if (Environment.TickCount - lastDrink < time)
{
return;
}
p.getPackets().closeInterfaces();
p.setTemporaryAttribute("drinkPotionTimer", Environment.TickCount);
p.setTemporaryAttribute("lastDrankPotion", j);
p.setTarget(null);
p.resetCombatTurns();
p.setEntityFocus(65535);
p.removeTemporaryAttribute("autoCasting");
Event drinkPotionEvent = new Event(delay);
drinkPotionEvent.setAction(() =>
{
drinkPotionEvent.stop();
if (p.isDead() || p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) <= 0)
{
return;
}
int item = i != 0 && POTIONS[i - 1][j] != -1 ? POTIONS[i - 1][j] : 229;
if (!p.getInventory().replaceItemSlot(POTIONS[i][j], item, slot))
{
return;
}
string drinkPotion = ItemData.forId(POTIONS[0][j]).getName().Replace("(", "").Replace(")", "").Replace("3", "").Replace("2", "").Replace("1", "").ToLower();
p.getPackets().sendMessage("You drink some of your " + drinkPotion + ".");
p.getPackets().sendMessage("You have " + (i == 0 ? "no" : i.ToString()) + " doses of potion left.");
switch (j)
{
case 0: //Attack potion [+3 and 10% of max attack]
statBoost(p, Skills.SKILL.ATTACK, 0.10, 3, false);
break;
case 1: //Antipoison potion
p.setPoisonAmount(0);
break;
case 2: //Strength potion [+3 and 10% of max strength]
statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
break;
case 3: //Restore potion [restores randomly between 10-39 points]
restorePotion(p, Skills.SKILL.DEFENCE, 10, 39);
restorePotion(p, Skills.SKILL.ATTACK, 10, 39);
restorePotion(p, Skills.SKILL.STRENGTH, 10, 39);
restorePotion(p, Skills.SKILL.RANGE, 10, 39);
restorePotion(p, Skills.SKILL.HITPOINTS, 10, 39);
break;
case 4: //Energy potion [restores 20% energy]
double newEnergy = p.getRunEnergy() * 0.20;
p.setRunEnergy(((p.getRunEnergy() + (int)newEnergy >= 100) ? 100 : (p.getRunEnergy() + (int)newEnergy)));
break;
case 5: //Defence potion [Should be +3 and 10% of max defence]
statBoost(p, Skills.SKILL.DEFENCE, 0.10, 3, false);
break;
case 6: //Agility potion [restores 2 or 3 agility points]
int newAgility = Misc.random(2, 3) + p.getSkills().getCurLevel(Skills.SKILL.AGILITY);
if (newAgility < p.getSkills().getMaxLevel(Skills.SKILL.AGILITY))
p.getSkills().setCurLevel(Skills.SKILL.AGILITY, newAgility);
break;
case 7: //Combat potion [Should be 10% of attack+strength and +3 to each].
statBoost(p, Skills.SKILL.ATTACK, 0.10, 3, false);
statBoost(p, Skills.SKILL.STRENGTH, 0.10, 3, false);
break;
case 8: //Prayer potion, [heals 7-31, formula = 7+floor(prayerlevel/4)]
int newPrayer = 7 + (int)Math.Floor((double)(p.getSkills().getMaxLevel(Skills.SKILL.PRAYER) / 4)) + p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
if (newPrayer < p.getSkills().getCurLevel(Skills.SKILL.PRAYER))
//.........這裏部分代碼省略.........
示例5: 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;
}
}
示例6: 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);
}
示例7: 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;
}
}
示例8: handleFirstClickObject
private void handleFirstClickObject(Player player, Packet packet)
{
int objectX = packet.readLEShort();
ushort objectId = (ushort)packet.readShortA();
int objectY = packet.readUShort();
if (objectX < 1000 || objectY < 1000 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null)
{
return;
}
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
Console.WriteLine("First object click = " + objectId + " " + objectX + " " + objectY);
if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY))
{
return;
}
else if (RuneCraft.enterRift(player, objectId, objectX, objectY))
{
return;
}
else if (RuneCraft.enterViaTiara(player, objectId, objectX, objectY))
{
player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ()));
return;
}
else if (RuneCraft.leaveAltar(player, objectId, objectX, objectY))
{
return;
}
else if (Barrows.leaveCrypt(player, objectId, objectX, objectY))
{
return;
}
else if (Barrows.tryOpenCoffin(player, objectId))
{
return;
}
else if (Barrows.openTunnelDoor(player, objectId, objectX, objectY))
{
return;
}
else if (Thieving.wantToThieveChest(player, objectId, objectX, objectY))
{
return;
}
else if (Agility.doAgility(player, objectId, objectX, objectY))
{
return;
}
else if (Farming.interactWithPatch(player, objectId, objectX, objectY, -1))
{
return;
}
else if (Server.getGlobalObjects().getDoors().useDoor(player, objectId, objectX, objectY, player.getLocation().getZ()))
{
return;
}
else if (LaddersAndStairs.useObject(player, objectId, new Location(objectX, objectY, player.getLocation().getZ()), 1))
{
return;
}
else if (WildernessObelisks.useWildernessObelisk(player, objectId, new Location(objectX, objectY, player.getLocation().getZ())))
{
return;
}
if (player.getTemporaryAttribute("unmovable") != null)
{
return;
}
player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ()));
switch (objectId)
{
case 2492: // essence mine portals
RuneCraft.leaveEssMine(player, new Location(objectX, objectY, player.getLocation().getZ()));
break;
case 5959:
case 5960:
Wilderness.handleLever(player, objectId, new Location(objectX, objectY, player.getLocation().getZ()));
break;
case 733: // Wilderness web
Wilderness.slashWeb(player, objectId, new Location(objectX, objectY, player.getLocation().getZ()));
break;
case 28089: // GE desk
Server.getGrandExchange().clickDesk(player, objectX, objectY, 1);
break;
case 9359: // Tzhaar main exit
TzHaar.exitTzhaar(player);
break;
case 31284: // Tzhaar entrance
TzHaar.enterTzhaar(player);
break;
case 9357: // Fight cave exit
FightCave.exitCave(player, objectX, objectY);
break;
//.........這裏部分代碼省略.........
示例9: 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.");
}
}
}
示例10: 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.");
}
示例11: 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;
}
}
}
示例12: handleEquipItem
private void handleEquipItem(Player player, Packet packet)
{
int item = packet.readLEShort();
int slot = packet.readShortA();
int interfaceId = packet.readInt();
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 (RuneCraft.emptyPouch(player, (RuneCraftData.POUCHES)player.getInventory().getItemInSlot(slot)))
{
return;
}
player.getEquipment().equipItem(player.getInventory().getItemInSlot(slot), slot);
}
}
示例13: 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;
}
示例14: 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])
{
//.........這裏部分代碼省略.........
示例15: newMagicAttack
//.........這裏部分代碼省略.........
}
target.setAttacker(p);
p.setTarget(target);
target.setLastAttacked(Environment.TickCount);
p.setLastAttack(Environment.TickCount);
p.setLastMagicAttack(Environment.TickCount);
p.setCombatTurns(p.getAttackSpeed());
Combat.setSkull(p, target);
if (damage > 0)
{
frozen = freezeTarget(index, target);
if (!frozen && index == 31)
{
endGfx = 1677;
}
}
if (AIR_GFX[index] != -1 || ((index == 31 || index == 27) && target is Player && ((Player)target).getWalkingQueue().isRunning()))
{
sendProjectile(index, target, p);
}
if (damage > target.getHp())
{
damage = target.getHp();
}
if (index == 47 && Misc.random(2) == 0)
{
endGfx = 85;
}
Combat.checkIfWillDie(target, damage);
Event doMagicAttackEvent = new Event(getSpellHitDelay(index));
doMagicAttackEvent.setAction(() =>
{
doMagicAttackEvent.stop();
if (p == null || p.isDead() || !fakeNPC && (target.isDead() || target.isHidden() || target.isDestroyed()))
{
return;
}
if (target.isAutoRetaliating() && target.getTarget() == null && damage > 0)
{
if (target is Npc)
{
}
else
{
if (((Player)target).getTemporaryAttribute("autoCastSpell") != null)
{
int autoCastSpell = (int)((Player)target).getTemporaryAttribute("autoCastSpell");
((Player)target).setTemporaryAttribute("autoCasting", true);
target.setTarget(p);
MagicCombat.newMagicAttack((Player)target, p, autoCastSpell, ((Player)target).getTemporaryAttribute("autoCastAncients") != null);
}
}
target.getFollow().setFollowing(p);
target.setEntityFocus(p.getClientIndex());
if ((target.getCombatTurns() <= (target.getAttackSpeed() / 2) || target.getCombatTurns() >= (target.getAttackSpeed())))
{
target.setCombatTurns(target.getAttackSpeed() / 2);
}
target.setTarget(p);
if (target is Player)
{
((Player)target).getWalkingQueue().resetWalkingQueue();
((Player)target).getPackets().clearMapFlag();
}
}
addMagicXp(p, target, damage, index, true);