本文整理汇总了C#中WorldServer.player.Player.getLocation方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getLocation方法的具体用法?C# Player.getLocation怎么用?C# Player.getLocation使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.getLocation方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
示例2: enterCrypt
/*
* The config to remove roofs is 1270
* The door is 6713
*
* Random door configs
* CONFIG = 452 0
CONFIG = 452 32
CONFIG = 452 96
CONFIG = 452 16480
CONFIG = 452 278624
CONFIG = 452 802912
CONFIG = 452 2900064
CONFIG = 452 2637920
CONFIG = 452 2638944
CONFIG = 452 2640992
CONFIG = 452 2645088
CONFIG = 452 2653280
CONFIG = 452 2649184
*/
public static bool enterCrypt(Player p)
{
for (int i = 0; i < MOUND_COORDS.Length; i++) {
for (int j = 0; j < MOUND_COORDS[i].Length; j++) {
if (p.getLocation().inArea(MOUND_COORDS[i][0], MOUND_COORDS[i][1], MOUND_COORDS[i][2], MOUND_COORDS[i][3]) && p.getLocation().getZ() == 0)
{
p.teleport(new Location(STAIR_COORDS[i][0], STAIR_COORDS[i][1], 3));
if (p.getBarrowTunnel() == -1) {
p.setBarrowTunnel(misc.random(5));
}
return true;
}
}
}
return false;
}
示例3: execute
public void execute(Player player, string[] arguments)
{
if (arguments.Length == 0)
{
player.getPackets().sendMessage("[Height command]: ::height 0 [0,1,2,3] are possible");
return;
}
int heightLevel = 0;
if (!int.TryParse(arguments[0], out heightLevel))
{
player.getPackets().sendMessage("[Height command]: ::height 0 [0,1,2,3] are possible");
return;
}
player.teleport(new Location(player.getLocation().getX(), player.getLocation().getY(), heightLevel));
}
示例4: 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;
}
示例5: 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);
}
示例6: 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();
}
示例7: interactWithBoatNPC
public static bool interactWithBoatNPC(Player p, Npc n)
{
int id = n.getId();
if (id != 4540 && id != 1304 && id != 2436 && id != 3781 && id != 1361 && id != 4962) {
return false;
}
p.setEntityFocus(n.getClientIndex());
AreaEvent interactWithBoatNPCAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1);
interactWithBoatNPCAreaEvent.setAction(() => {
n.setFaceLocation(p.getLocation());
p.setFaceLocation(n.getLocation());
p.setEntityFocus(65535);
switch(n.getId()) {
case 4540: // Home boat
showBentleyDialogue(p, 240);
break;
case 1304: // Canifis sailor
showCanifisSailorDialogue(p, 280);
break;
case 2436: // Waterbirth isle
showJarvaldDialogue(p, 300);
break;
case 3781: // Pest control squire
showSquireDialogue(p, 340);
break;
case 1361: // Warrior guild
showArnorDialogue(p, 370);
break;
case 4962: // fremmenik shore
showCaptainBarnabyDialogue(p, 410);
break;
}
});
Server.registerCoordinateEvent(interactWithBoatNPCAreaEvent);
return true;
}
示例8: 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;
}
示例9: fightCaveAttacks
public static void fightCaveAttacks(Npc npc, Player p)
{
if (npc.isDead() || npc.isDestroyed() || p.isDead() || p.isDestroyed() || p.isDead() || !Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
return;
}
int damage = misc.random(npc.getMaxHit());
int prayer = p.getPrayers().getHeadIcon();
int hitDelay = npc.getHitDelay();
int animation = npc.getAttackAnimation();
switch(npc.getId()) {
case 2734: // Tz-Kih (lvl 22)
case 2735:
if (prayer == PrayerData.MELEE) {
damage = 0;
}
break;
case 2739: // Tz-Xil (lvl 90)
case 2740:
if (prayer == PrayerData.RANGE) {
damage = 0;
}
p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1616, 50, 40, 34, 50, p);
break;
case 2741: // Yt-MejKot (lvl 180)
case 2742:
if (prayer == PrayerData.MELEE) {
damage = 0;
}
// TODO healing
break;
case 2743: // Ket-Zek (lvl 360)
case 2744:
if (!p.getLocation().withinDistance(npc.getLocation(), 2)) {
hitDelay = 1600;
animation = 9266;
npc.setLastGraphics(new Graphics(1622));
damage = misc.random(49);
if (prayer == PrayerData.MAGIC) {
damage = 0;
}
Event sendProjectileToNpc = new Event(300);
sendProjectileToNpc.setAction(() => {
sendProjectileToNpc.stop();
p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1623, 50, 40, 34, 80, p);
});
Server.registerEvent(sendProjectileToNpc);
} else {
damage = misc.random(64);
if (prayer == PrayerData.MELEE) {
damage = 0;
}
}
break;
case 2745: // TzTok Jad (lvl 702)
doJadAttacks(p, npc);
break;
}
if (npc.getId() == 2745){
return;
}
if (animation != 65535) {
npc.setLastAnimation(new Animation(animation));
}
p.setLastAttacked(Environment.TickCount);
npc.setLastAttack(Environment.TickCount);
p.setAttacker(npc);
npc.resetCombatTurns();
if (damage > p.getHp()) {
damage = p.getHp();
}
int npcId = npc.getId();
Event losePrayerFightingEvent = new Event(hitDelay);
losePrayerFightingEvent.setAction(() => {
losePrayerFightingEvent.stop();
if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
return;
}
if (npcId == 2734 || npcId == 2735) {
int prayerLevel = p.getSkills().getCurLevel(Skills.SKILL.PRAYER);
int newPrayerLevel = prayerLevel -= (damage + 1);
if (newPrayerLevel <= 0) {
newPrayerLevel = 0;
}
p.getSkills().setCurLevel(Skills.SKILL.PRAYER, newPrayerLevel);
p.getPackets().sendSkillLevel(Skills.SKILL.PRAYER);
} else if (npcId == 2743 || npcId == 2744) {
if (misc.random(1) == 0) {
p.setLastGraphics(new Graphics(1624, 0));
}
}
if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
p.setLastAnimation(new Animation(p.getDefenceAnimation()));
}
p.hit(damage);
});
//.........这里部分代码省略.........
示例10: updateVariables
/*
* NOTE: Anything that goes in here and varies between HD and LD,
* reset the variable in ActionSender.configureGameScreen
*/
public void updateVariables(Player p)
{
int currentLevel = p.getLocation().wildernessLevel();
if (currentLevel != -1)
{ //Is in wilderness.
int lastWildLevel = (p.getTemporaryAttribute("wildLvl") == null) ? -1 : (int)p.getTemporaryAttribute("wildLvl");
if (currentLevel != lastWildLevel)
{
if (currentLevel > 0)
{
p.setTemporaryAttribute("wildLvl", currentLevel);
if (p.getTemporaryAttribute("inWild") == null)
{
p.getPackets().sendPlayerOption("Attack", 1, 1);
p.getPackets().sendOverlay(381);
p.setTemporaryAttribute("inWild", true);
}
}
else
{
if (p.getTemporaryAttribute("inWild") != null)
{
p.getPackets().sendPlayerOption("null", 1, 1);
p.getPackets().sendRemoveOverlay();
p.removeTemporaryAttribute("wildLvl");
p.removeTemporaryAttribute("inWild");
}
}
}
}
if (Location.inMultiCombat(p.getLocation()))
{
if (p.getTemporaryAttribute("inMulti") == null)
{
p.getPackets().displayMultiIcon();
p.setTemporaryAttribute("inMulti", true);
}
}
else
{
if (p.getTemporaryAttribute("inMulti") != null)
{
p.getPackets().removeMultiIcon();
p.removeTemporaryAttribute("inMulti");
}
}
if (Location.atDuelArena(p.getLocation()))
{
if (p.getDuel() != null)
{
if (p.getDuel().getStatus() == 5 || p.getDuel().getStatus() == 6)
{
p.getPackets().sendPlayerOption("Fight", 1, 1);
}
}
if (p.getTemporaryAttribute("challengeUpdate") != null)
{
p.getPackets().sendPlayerOption("Challenge", 1, 0);
p.removeTemporaryAttribute("challengeUpdate");
}
if (p.getTemporaryAttribute("atDuelArea") == null)
{
p.getPackets().sendPlayerOption("Challenge", 1, 0);
p.getPackets().sendOverlay(638);
p.setTemporaryAttribute("atDuelArea", true);
}
}
else
{
if (p.getTemporaryAttribute("atDuelArea") != null)
{
p.getPackets().sendPlayerOption("null", 1, 0);
p.getPackets().sendRemoveOverlay();
p.removeTemporaryAttribute("atDuelArea");
}
}
if (Location.atBarrows(p.getLocation()))
{
if (p.getTemporaryAttribute("atBarrows") == null)
{
p.getPackets().sendOverlay(24);
p.getPackets().setMinimapStatus(2);
p.getPackets().sendConfig(452, 2652256); // doors
if (p.getTemporaryAttribute("betweenDoors") == null)
{
if (Barrows.betweenDoors(p))
{
p.setTemporaryAttribute("betweenDoors", true);
p.getPackets().sendConfig(1270, 1);
}
}
p.getPackets().modifyText("Kill Count: " + p.getBarrowKillCount(), 24, 0);
p.setTemporaryAttribute("atBarrows", true);
Barrows.prayerDrainEvent(p);
bool allBrothersKilled = true;
//.........这里部分代码省略.........
示例11: doJadAttacks
private static void doJadAttacks(Player p, Npc npc)
{
if (npc.getHp() <= (npc.getMaxHp() * 0.50)) {
if (p.getFightCave() != null) {
if (!p.getFightCave().isHealersSpawned())
{
summonJadHealers(p, npc);
p.getFightCave().setHealersSpawned(true);
}
}
}
npc.resetCombatTurns();
npc.setEntityFocus(p.getClientIndex());
switch(misc.random(1)) {
case 0: // Range
npc.setLastAnimation(new Animation(9276));
npc.setLastGraphics(new Graphics(1625));
Event jadRangeAttackEvent = new Event(1600);
int jadRangeAttackStatus = 0;
jadRangeAttackEvent.setAction(() => {
int hit = 0;
int prayer = p.getPrayers().getHeadIcon();
if (jadRangeAttackStatus == 0)
{
jadRangeAttackStatus++;
jadRangeAttackEvent.setTick(1500);
p.setLastGraphics(new Graphics(451));
if (prayer == PrayerData.RANGE) {
hit = 0;
} else {
hit = misc.random(96);
}
} else {
if (prayer != PrayerData.RANGE) {
hit = misc.random(96);
}
jadRangeAttackEvent.stop();
p.setLastAttacked(Environment.TickCount);
npc.setLastAttack(Environment.TickCount);
p.setAttacker(npc);
if (hit > p.getHp()) {
hit = p.getHp();
}
if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
return;
}
if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
p.setLastAnimation(new Animation(p.getDefenceAnimation()));
}
p.hit(hit);
Event animationEvent = new Event(100);
animationEvent.setAction(() => {
animationEvent.stop();
p.setLastGraphics(new Graphics(157, 0, 100));
});
Server.registerEvent(animationEvent);
}
});
Server.registerEvent(jadRangeAttackEvent);
break;
case 1: // Magic
npc.setLastGraphics(new Graphics(1626));
Event jadMagicAttackEvent = new Event(300);
int jadMagicAttackStatus = 0;
jadMagicAttackEvent.setAction(() => {
int hit = 0;
int prayer = p.getPrayers().getHeadIcon();
npc.setLastAnimation(new Animation(9278));
if (jadMagicAttackStatus == 0)
{
jadMagicAttackStatus++;
jadMagicAttackEvent.setTick(1600);
p.getPackets().sendProjectile(npc.getLocation(), p.getLocation(), 32, 1627, 50, 40, 34, 90, p);
} else {
jadMagicAttackEvent.stop();
if (prayer == PrayerData.MAGIC) {
hit = 0;
} else {
hit = misc.random(96);
}
p.setLastAttacked(Environment.TickCount);
npc.setLastAttack(Environment.TickCount);
p.setAttacker(npc);
if (hit > p.getHp()) {
hit = p.getHp();
}
if (!Location.inFightCave(p.getLocation()) || p.getTeleportTo() != null) {
return;
}
if ((p.getCombatTurns() > 2 || p.getCombatTurns() < 0)) {
p.setLastAnimation(new Animation(p.getDefenceAnimation()));
}
p.hit(hit);
Event animationEvent = new Event(100);
animationEvent.setAction(() => {
animationEvent.stop();
p.setLastGraphics(new Graphics(157, 0, 100));
});
Server.registerEvent(animationEvent);
//.........这里部分代码省略.........
示例12: sendProjectile
private static void sendProjectile(int index, Entity target, Player player)
{
foreach(Player p in Server.getPlayerList()) {
if (p.getLocation().withinDistance(player.getLocation(), 60)) {
if (index != 31 && index != 27) { // ice barrage + ice blitz
p.getPackets().sendProjectile(player.getLocation(), target.getLocation(), getStartingSpeed(index), AIR_GFX[index], 50, getProjectileHeight(index), getProjectileEndHeight(index), 100, target);
} else {
p.getPackets().sendProjectile(player.getLocation(), target.getLocation(), getStartingSpeed(index), 368, 50, getProjectileHeight(index), getProjectileEndHeight(index), 100, target);
}
}
}
}
示例13: talkToBob
public static void talkToBob(Player p, Npc npc, int item, int option)
{
p.setEntityFocus(npc.getClientIndex());
AreaEvent talkToBobAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1);
talkToBobAreaEvent.setAction(() => {
npc.setFaceLocation(p.getLocation());
p.setFaceLocation(npc.getLocation());
p.setEntityFocus(65535);
if (option == 0) { // use item on bob
if (item > 0) {
p.setTemporaryAttribute("bobsAxesBarrowItem", item);
showBobDialogue(p, 101);
}
} else if (option == 1) { // talk
showBobDialogue(p, 107);
} else if (option == 2) { // trade
p.setShopSession(new ShopSession(p, 4));
}
});
Server.registerCoordinateEvent(talkToBobAreaEvent);
}
示例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]) {
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;
}
//.........这里部分代码省略.........
示例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;
}