本文整理汇总了C#中WorldServer.player.Player.removeTemporaryAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Player.removeTemporaryAttribute方法的具体用法?C# Player.removeTemporaryAttribute怎么用?C# Player.removeTemporaryAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.removeTemporaryAttribute方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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);
}
示例2: travel
private static void travel(Player p, int index, bool returning)
{
p.setTemporaryAttribute("unmovable", true);
p.getPackets().displayInterface(120);
if (returning) {
p.getPackets().sendMessage("You sail off back to Oo'glog..");
} else {
p.getPackets().sendMessage("You climb aboard Captain Bentley's boat and set sail to " + DESTINATION_NAMES[index] + ".");
}
Event travelEvent = new Event(2000);
int travelCounter = 0;
travelEvent.setAction(() => {
if (travelCounter == 0)
{
travelCounter++;
travelEvent.setTick(600);
if (returning) {
p.teleport(new Location(2622, 2857, 0));
} else {
p.teleport(new Location(LOCATIONS[index][0], LOCATIONS[index][1], LOCATIONS[index][2]));
}
} else {
travelEvent.stop();
p.getPackets().sendOverlay(170);
p.removeTemporaryAttribute("unmovable");
p.getPackets().sendMessage(returning ? "The boat arrives back in Oo'glog." : DESTINATION_MESSAGES[index]);
p.getPackets().closeInterfaces();
Event removeOverlayEvent = new Event(2000);
removeOverlayEvent.setAction(() => {
removeOverlayEvent.stop();
p.getPackets().sendRemoveOverlay();
if (index == 1) {
p.removeTemporaryAttribute("snowInterface");
}
});
Server.registerEvent(removeOverlayEvent);
}
});
Server.registerEvent(travelEvent);
}
示例3: teleblockPlayer
public static void teleblockPlayer(Player killer, Player target)
{
int teleblockDelay = 300000;
if (target.getPrayers().getHeadIcon() == PrayerData.MAGIC) {
teleblockDelay = 150000;
}
target.setTemporaryAttribute("teleblocked", true);
target.setTeleblockTime(Environment.TickCount + teleblockDelay);
Event removeTeleBlockEvent = new Event(teleblockDelay);
removeTeleBlockEvent.setAction(() => {
removeTeleBlockEvent.stop();
if (target != null) {
target.removeTemporaryAttribute("teleblocked");
target.setTeleblockTime(0);
}
});
Server.registerEvent(removeTeleBlockEvent);
}
示例4: verifyEnterTunnel
public static void verifyEnterTunnel(Player p)
{
p.getPackets().closeInterfaces();
if (p.getTemporaryAttribute("barrowTunnel") != null) {
if ((int) p.getTemporaryAttribute("barrowTunnel") == 2) {
p.teleport(new Location(3568, 9712, 0));
p.removeTemporaryAttribute("barrowTunnel");
return;
}
}
p.getPackets().sendChatboxInterface(228);
p.getPackets().modifyText("Yeah, I'm fearless!", 228, 2);
p.getPackets().modifyText("No way, that looks scary!", 228, 3);
p.setTemporaryAttribute("barrowTunnel", 2);
}
示例5: newMagicAttack
public static void newMagicAttack(Player p, Entity target, int id, bool ancients)
{
int index = getSpellIndex(p, id, ancients);
bool autoCasting = p.getTemporaryAttribute("autoCasting") != null;
bool fakeNPC = target != null && target is Npc && ((Npc)target).getId() == 0;
Entity lastAutocastEntity = null;
bool frozen = false;
if (index == -1) {
return;
}
if (p.getTarget() == null) {
if (autoCasting) {
if (Location.inMultiCombat(p.getLocation())) {
lastAutocastEntity = (Entity) p.getTemporaryAttribute("autocastEntity") == null ? null : (Entity) p.getTemporaryAttribute("autocastEntity");
if (lastAutocastEntity == null || lastAutocastEntity is Player) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
if (hitsMulti(p, index)) {
Location location = (Location)p.getTemporaryAttribute("autocastLocation");
Entity newTarget = new Npc(0);
newTarget.setLocation(location);
p.setTarget(newTarget);
newMagicAttack(p, newTarget, id, ancients);
return;
}
} else {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
} else {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
} else {
if (!canCastSpell(p, target, index, fakeNPC)) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
}
int distance = 8;
if (target is Player) {
if (((Player)target).getSprites().getPrimarySprite() != -1) {
distance = 8;
}
}
if (!fakeNPC) { // we're actually attacking a real npc/player
if (!p.getLocation().withinDistance(target.getLocation(), distance)) {
p.getFollow().setFollowing(target);
Event attemptMagicAttackEvent = new Event(500);
int attemptMagicAttackCounter = 0;
attemptMagicAttackEvent.setAction(() => {
if (p.getLocation().withinDistance(target.getLocation(), distance) && p.getTarget() != null) {
attemptMagicAttackEvent.stop();
newMagicAttack(p, target, id, ancients);
return;
}
attemptMagicAttackCounter++;
if (attemptMagicAttackCounter >= 12)
{
attemptMagicAttackEvent.stop();
}
});
Server.registerEvent(attemptMagicAttackEvent);
return;
}
}
int timeSinceLastCast = autoCasting ? 3500 : 2000;
if (Environment.TickCount - p.getLastMagicAttack() < timeSinceLastCast) {
p.getWalkingQueue().resetWalkingQueue();
//return;
}
int time = p.getLastCombatType().Equals(Combat.CombatType.MAGE) ? 1550 : 600;
if (Environment.TickCount - p.getLastAttack() < time) {
int delay = p.getLastCombatType().Equals(Combat.CombatType.MAGE) ? 1350 : 800;
Event attemptMagicAttackEvent = new Event(500);
attemptMagicAttackEvent.setAction(() => {
if (Environment.TickCount - p.getLastAttack() > delay) {
attemptMagicAttackEvent.stop();
newMagicAttack(p, target, id, ancients);
}
});
Server.registerEvent(attemptMagicAttackEvent);
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
p.setLastCombatType(Combat.CombatType.MAGE);
return;
}
if (fakeNPC && !monsterInArea(p, target)) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
int endGfx = END_GFX[index];
//.........这里部分代码省略.........
示例6: showAliDialogue
public static void showAliDialogue(Player p, int status)
{
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 205:
p.getPackets().sendNPCHead(1862, 241, 2);
p.getPackets().modifyText("Ali Morissane", 241, 3);
p.getPackets().modifyText("Would you like to go back to Lletya?", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 206;
break;
case 206:
p.getPackets().sendChatboxInterface2(228);
p.getPackets().modifyText("Yes please, let's go", 228, 2);
p.getPackets().modifyText("Not yet", 228, 3);
newStatus = 207;
break;
case 207:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Yes please, let's go.", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 208;
break;
case 208:
p.getPackets().sendNPCHead(1862, 241, 2);
p.getPackets().modifyText("Ali Morissane", 241, 3);
p.getPackets().modifyText("Very well.", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 209;
break;
case 209:
p.setTemporaryAttribute("unmovable", true);
p.getPackets().displayInterface(120);
p.getPackets().sendMessage("Your camel trots off slowly out of the desert..");
Event moveBackToLletyaEvent = new Event(2000);
int moveBackToLletyaCounter = 0;
moveBackToLletyaEvent.setAction(() => {
if (moveBackToLletyaCounter == 0)
{
moveBackToLletyaCounter++;
moveBackToLletyaEvent.setTick(600);
p.teleport(new Location(2340, 3799, 0));
} else {
moveBackToLletyaEvent.stop();
p.removeTemporaryAttribute("unmovable");
p.getPackets().sendMessage("..You and Ali are back in Lletya.");
p.getPackets().closeInterfaces();
}
});
Server.registerEvent(moveBackToLletyaEvent);
break;
case 210:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Not yet.", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 211;
break;
case 211:
p.getPackets().sendNPCHead(1862, 241, 2);
p.getPackets().modifyText("Ali Morissane", 241, 3);
p.getPackets().modifyText("No problem, I will be here when you decide to leave.", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}
示例7: openTunnelDoor
public static bool openTunnelDoor(Player player, int doorId, int x, int y)
{
if (doorId < 6716 || (doorId > 6731 && doorId < 6735) || doorId > 6750) {
return false;
}
int index = getDoorIndex(doorId, x, y);
int index2 = getOtherDoor(x, y); // index of the door next to the one you clicked.
if (index == -1 || index2 == -1) {
return false;
}
bool betweenDoors = player.getTemporaryAttribute("betweenDoors") != null;
Location clickedDoor = new Location(DOOR_LOCATION[index][0], DOOR_LOCATION[index][1], 0);
Location otherDoor = new Location(DOOR_LOCATION[index2][0], DOOR_LOCATION[index2][1], 0);
int openDoorId = DOOR_OPEN_DIRECTION[index][0];
int openDoorId2 = DOOR_OPEN_DIRECTION[index2][0];
int openDirection = DOOR_OPEN_DIRECTION[index][2];
int newX = openDirection == 1 ? x+1 : openDirection == 2 ? x : openDirection == 3 ? x-1 : openDirection == 4 ? x : x;
int newY = openDirection == 1 ? y : openDirection == 2 ? y+1 : openDirection == 3 ? y : openDirection == 4 ? y-1 : y;
int newX2 = openDirection == 1 ? DOOR_LOCATION[index2][0] + 1 : openDirection == 2 ? DOOR_LOCATION[index2][0] : openDirection == 3 ? DOOR_LOCATION[index2][0] - 1 : openDirection == 4 ? DOOR_LOCATION[index2][0] : DOOR_LOCATION[index2][0];
int newY2 = openDirection == 1 ? DOOR_LOCATION[index2][1] : openDirection == 2 ? DOOR_LOCATION[index2][1] + 1 : openDirection == 3 ? DOOR_LOCATION[index2][1] : openDirection == 4 ? DOOR_LOCATION[index2][1] - 1 : DOOR_LOCATION[index2][1];
int[] doorStandCoordinates = getDoorCoordinates(player, index, index2, betweenDoors);
int[] walkDirections = getWalkDirections(player, index, index2, betweenDoors);
player.setFaceLocation(clickedDoor);
AreaEvent doorsWalkAreaEvent = new AreaEvent(player, doorStandCoordinates[0], doorStandCoordinates[1], doorStandCoordinates[2] + 1, doorStandCoordinates[3] + 1);
doorsWalkAreaEvent.setAction(() => {
player.setTemporaryAttribute("unmovable", true);
Event forceWalkDoorEvent = new Event(800);
forceWalkDoorEvent.setAction(() => {
player.getWalkingQueue().resetWalkingQueue();
foreach(Player p in Server.getPlayerList()) { //change door for all logged in players? uhh what?
p.getPackets().removeObject(clickedDoor, openDoorId == 6713 ? 4 : 3, 0);
p.getPackets().removeObject(otherDoor, openDoorId2 == 6732 ? 3 : 4, 0);
p.getPackets().createObject(openDoorId, new Location(newX, newY, 0), DOOR_OPEN_DIRECTION[index][1], 0);
p.getPackets().createObject(openDoorId2, new Location(newX2, newY2, 0), DOOR_OPEN_DIRECTION[index2][1], 0);
}
player.getWalkingQueue().forceWalk(walkDirections[0], walkDirections[1]);
forceWalkDoorEvent.stop();
});
Server.registerEvent(forceWalkDoorEvent);
Event betweenDoorsEvent = new Event(betweenDoors ? 2200 : 1900);
betweenDoorsEvent.setAction(() => {
int face = openDirection == 3 ? 0 : openDirection == 4 ? 3 : openDirection == 2 ? 1 : 2;
foreach(Player p in Server.getPlayerList()) {
p.getPackets().removeObject(new Location(newX, newY, 0), openDoorId == 6713 ? 4 : 3, 0);
p.getPackets().removeObject(new Location(newX2, newY2, 0), openDoorId2 == 6732 ? 3 : 4, 0);
p.getPackets().createObject(DOORS[index], clickedDoor, face, 0);
p.getPackets().createObject(DOORS[index2], otherDoor, face, 0);
}
player.removeTemporaryAttribute("unmovable");
if (!betweenDoors) {
player.getPackets().sendConfig(1270, 1);
player.setTemporaryAttribute("betweenDoors", true);
} else {
player.getPackets().sendConfig(1270, 0);
player.removeTemporaryAttribute("betweenDoors");
}
betweenDoorsEvent.stop();
});
Server.registerEvent(betweenDoorsEvent);
});
Server.registerCoordinateEvent(doorsWalkAreaEvent);
return true;
}
示例8: setAutoCastSpell
public static void setAutoCastSpell(Player p, int spell, int spellIndex, bool ancients)
{
p.getPackets().modifyText(AUTOCAST_NAME[spell], 90, 11);
p.getPackets().showChildInterface(90, 83, false);
p.getPackets().showChildInterface(90, AUTOCAST_CONFIG[spell], true);
p.getPackets().sendConfig(43, 3);
p.getPackets().sendTab(83, 90);
p.getPackets().modifyText(p.getEquipment().getSlot(ItemData.EQUIP.WEAPON).getDefinition().getName(), 90, 0);
p.setTemporaryAttribute("autoCastSpell", spellIndex);
p.setTemporaryAttribute("autoCastSpell2", spell);
if (ancients) {
p.setTemporaryAttribute("autoCastAncients", ancients);
} else {
p.removeTemporaryAttribute("autoCastAncients");
}
}
示例9: configureSelectSpellInterface
public static void configureSelectSpellInterface(Player p)
{
p.removeTemporaryAttribute("autoCasting");
if (p.getMagicType() == 1) {
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4170)
{ // Slayer staff.
p.getPackets().sendTab(83, 310);
return;
}
else if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841)
{ // Void knight mace.
p.getPackets().sendTab(83, 406);
return;
} else {
p.getPackets().sendTab(83, 319);
}
} else if (p.getMagicType() == 2) {
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4675)
{ // Ancient staff.
p.getPackets().sendTab(83, 388);
} else {
p.getPackets().sendMessage("You cannot autocast Ancient Magic with this staff.");
}
}
}
示例10: cancelAutoCast
public static void cancelAutoCast(Player p, bool cancelCast)
{
if (cancelCast) {
p.getEquipment().setWeapon();
//p.getPackets().sendConfig(43, 0);
resetSpellIcon(p);
p.removeTemporaryAttribute("autoCastSpell");
p.removeTemporaryAttribute("autoCastAncients");
p.getPackets().showChildInterface(90, 83, true);
p.getPackets().modifyText("Spell", 90, 11);
return;
}
if (p.getTemporaryAttribute("autoCastSpell") != null) {
setAutoCastSpell(p, (int)p.getTemporaryAttribute("autoCastSpell2"), (int)p.getTemporaryAttribute("autoCastSpell"), (bool)(p.getTemporaryAttribute("autoCastAncients") != null ? true : false));
} else {
//p.getPackets().sendConfig(43, 0);
resetSpellIcon(p);
p.getEquipment().setWeapon();
p.getPackets().showChildInterface(90, 83, true);
p.getPackets().modifyText("Spell", 90, 11);
p.removeTemporaryAttribute("autoCastSpell");
p.removeTemporaryAttribute("autoCastAncients");
p.removeTemporaryAttribute("autoCastSpell2");
}
}
示例11: 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;
//.........这里部分代码省略.........
示例12: teleport
public static void teleport(Player p, LoadedLaddersAndStairs.HeightObject obj)
{
p.getWalkingQueue().resetWalkingQueue();
p.setTemporaryAttribute("unmovable", true);
p.setFaceLocation(obj.getLocation());
if (obj.getAnimation() != -1)
{
p.setLastAnimation(new Animation(obj.getAnimation()));
}
Event teleportEvent = new Event(obj.getAnimation() != -1 ? obj.getTeleDelay() : 500);
teleportEvent.setAction(() =>
{
teleportEvent.stop();
p.teleport(obj.getTeleLocation());
p.removeTemporaryAttribute("unmovable");
});
Server.registerEvent(teleportEvent);
}