本文整理匯總了C#中RS2.Server.player.Player.getTemporaryAttribute方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.getTemporaryAttribute方法的具體用法?C# Player.getTemporaryAttribute怎麽用?C# Player.getTemporaryAttribute使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RS2.Server.player.Player
的用法示例。
在下文中一共展示了Player.getTemporaryAttribute方法的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: displayFightPitsInterface
public void displayFightPitsInterface(Player p)
{
if (p.getTemporaryAttribute("cantDoAnything") != null)
{
return;
}
p.getPackets().sendConfig(560, playersPlaying.Count - 1);
p.getPackets().modifyText("Current champion: " + getLastWinnerName(), 373, 0);
p.getPackets().sendOverlay(373);
}
示例3: handleExamineObject
private void handleExamineObject(Player player, Packet packet)
{
ushort id = (ushort)packet.readLEShortA();
if (player.getTemporaryAttribute("unmovable") != null)
{
return;
}
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
player.getPackets().sendMessage("[Id: " + id + "] " + ObjectData.forId(id).getExamine());
}
示例4: display
public static void display(Player player, int buttonId)
{
int j = 0;
for (int i = 125; i < 149; i++)
{
if (buttonId == i)
{
int skillFlashFlags = (int)(player.getTemporaryAttribute("skillFlashFlags") == null ? 0 : (int)player.getTemporaryAttribute("skillFlashFlags"));
if ((skillFlashFlags & getSkillFlashingIcon(j)) == getSkillFlashingIcon(j))
{
skillFlashFlags &= ~getSkillFlashingIcon(j); //turn off this skill icon flashing animation bit.
player.getPackets().sendConfig(1179, skillFlashFlags); //stop flashing the skill you clicked on, if it was flashing.
player.setTemporaryAttribute("skillFlashFlags", skillFlashFlags); //update the variable for remaining flashing skill icons.
}
player.getPackets().displayInterface(499);
player.getPackets().sendConfig(965, MENU_ID[j]);
player.setTemporaryAttribute("SkillMenu", (int)MENU_ID[j]);
break;
}
j++;
}
}
示例5: 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;
}
}
示例6: getHairStyle
private static int getHairStyle(Player p, bool decrease)
{
int oldHair = p.getAppearance().getLook(0);
int newHair = oldHair;
if (p.getTemporaryAttribute("hairToggle") == null)
{
p.setTemporaryAttribute("hairToggle", 0);
return 0;
}
newHair = (int)p.getTemporaryAttribute("hairToggle");
newHair = decrease ? -1 : +1;
if (newHair == 11)
{
newHair = 186;//
}
else if (newHair == 12)
{
newHair = 188;//
}
else if (newHair == 13)
{
newHair = 190;//
}
else if (newHair == 14)
{
newHair = 192;//
}
else if (newHair == 15)
{
newHair = 194;//
}
else if (newHair == 16)
{
newHair = 196; //
}
else if (newHair == 17)
{
//17 to 25 dump from rs
}
p.setTemporaryAttribute("hairToggle", newHair);
return newHair;
}
示例7: crossDitch
public static void crossDitch(Player p, int x, int y)
{
if (p.getTemporaryAttribute("unmovable") != null)
{
return;
}
AreaEvent crossDitchAreaEvent = new AreaEvent(p, x, y - 1, x, y + 2);
crossDitchAreaEvent.setAction(() =>
{
p.getPackets().closeInterfaces();
p.getWalkingQueue().resetWalkingQueue();
p.setTemporaryAttribute("unmovable", true);
int newY = p.getLocation().getY() >= 3523 ? p.getLocation().getY() - 3 : p.getLocation().getY() + 3;
int dir = newY == 3 ? 0 : 4;
Location faceLocation = new Location(p.getLocation().getX(), dir == 3 ? 3523 : 3520, 0);
p.setFaceLocation(faceLocation);
Event crossDitchMoveEvent = new Event(500);
crossDitchMoveEvent.setAction(() =>
{
crossDitchMoveEvent.stop();
p.setLastAnimation(new Animation(6132));
int regionX = p.getUpdateFlags().getLastRegion().getRegionX();
int regionY = p.getUpdateFlags().getLastRegion().getRegionY();
int lX = (p.getLocation().getX() - ((regionX - 6) * 8));
int lY = (p.getLocation().getY() - ((regionY - 6) * 8));
ForceMovement movement = new ForceMovement(lX, lY, lX, newY, 33, 60, dir);
p.setForceMovement(movement);
p.setFaceLocation(new Location(x, y, 0));
Event crossDitchTeleportEvent = new Event(1250);
crossDitchTeleportEvent.setAction(() =>
{
crossDitchTeleportEvent.stop();
int playerY = p.getLocation().getY();
int nY = playerY >= 3523 ? 3520 : 3523;
p.teleport(new Location(p.getLocation().getX(), nY, 0));
p.removeTemporaryAttribute("unmovable");
});
Server.registerEvent(crossDitchTeleportEvent);
});
Server.registerEvent(crossDitchMoveEvent);
});
Server.registerCoordinateEvent(crossDitchAreaEvent);
}
示例8: canWalk
private bool canWalk(Player player, Packet packet, bool following)
{
if (player.getTemporaryAttribute("smeltingBar") != null)
{
Smelting.setAmountToZero(player);
return false;
}
else if (player.getTemporaryAttribute("teleporting") != null && player.getTemporaryAttribute("homeTeleporting") == null)
{
return false;
}
else if (player.isFrozen())
{
player.getPackets().sendMessage("A magic force prevents you from moving!");
return false;
}
else if (player.getDuel() != null)
{
if (player.getDuel().ruleEnabled(DuelSession.RULE.NO_MOVEMENT))
{
if (player.getDuel().getStatus() == 5 || player.getDuel().getStatus() == 6)
{
if (player.getTarget() == null)
player.getPackets().sendMessage("Movement is disabled for this duel.");
return false;
}
}
}
else if (player.getTemporaryAttribute("unmovable") != null || player.getTemporaryAttribute("cantDoAnything") != null)
{
return false;
}
else if (player.isDead())
{
return false;
}
else if (player.getTeleportTo() != null)
{
return false;
}
return true;
}
示例9: 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);
}
示例10: 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);
}
示例11: 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;
}
}
}
示例12: 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;
}
}
示例13: handleLever
public static void handleLever(Player p, int id, Location loc)
{
if ((p.getTemporaryAttribute("teleporting") != null))
{
return;
}
for (int i = 0; i < LEVER_COORDINATES.Length; i++)
{
Location loc1 = new Location(LEVER_COORDINATES[i][0], LEVER_COORDINATES[i][1], LEVER_COORDINATES[i][2]);
if (loc.Equals(loc1))
{
int index = i;
Location loc2 = new Location(LEVER_FACE_COORDINATES[i][0], LEVER_FACE_COORDINATES[i][1], LEVER_FACE_COORDINATES[i][2]);
CoordinateEvent wildernessHandleLeverCoordinateEvent = new CoordinateEvent(p, loc);
wildernessHandleLeverCoordinateEvent.setAction(() =>
{
p.setFaceLocation(loc2);
displayWildernessLeverOptions(p, index);
});
Server.registerCoordinateEvent(wildernessHandleLeverCoordinateEvent);
return;
}
}
LaddersAndStairs.useLever(p, id, loc); // Used for default levers/levers with no options
}
示例14: 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();
}
示例15: eatFood
private static void eatFood(Player p, int i, int j, int slot)
{
//delay at which you eat food 0.5 seconds (half a second per eat).
int delay = 500;
//If you are dead or yourHp is zero (this should be enough), also if variable is set to die from next attack
if (p.isDead() || p.getHp() <= 0 || p.getTemporaryAttribute("willDie") != null)
return;
//Last time you ate timer was previously set.
if (p.getTemporaryAttribute("eatFoodTimer") != null)
{
//Check if the timer has passed the time of 1.2 seconds
if (Environment.TickCount - (int)p.getTemporaryAttribute("eatFoodTimer") < 1200)
{
return;
}
}
//if you are in a duel
if (p.getDuel() != null)
{
//dueling with No Food rule enabled
if (p.getDuel().ruleEnabled(DuelSession.RULE.NO_FOOD))
{
p.getPackets().sendMessage("Food has been disabled for this duel!");
return;
}
}
//Set timer right now because you are eating some food.
p.setTemporaryAttribute("eatFoodTimer", Environment.TickCount);
//while you are eating the target you are attacking gets reset.
p.setTarget(null);
p.resetCombatTurns();
p.setEntityFocus(65535);
p.getPackets().closeInterfaces();
p.removeTemporaryAttribute("autoCasting");
//start eating the food at delay which is 0.5 of a second / half a second.
Event eatFoodEvent = new Event(delay);
eatFoodEvent.setAction(() =>
{
//make the food eating event stop after this time.
eatFoodEvent.stop();
//if you are dead or your hp is zero aka dead.
if (p.isDead() || p.getHp() <= 0)
{
return;
}
int newHealth = p.getSkills().getCurLevel(Skills.SKILL.HITPOINTS) + FOOD_HEAL[j];
int item = i != 2 && FOOD[i + 1][j] != -1 ? FOOD[i + 1][j] : -1;
if (!p.getInventory().replaceItemSlot(FOOD[i][j], item, slot))
{
return;
}
p.getPackets().sendMessage("You eat the " + ItemData.forId(FOOD[i][j]).getName().ToLower() + ".");
p.getSkills().setCurLevel(Skills.SKILL.HITPOINTS, newHealth > p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS) ? p.getSkills().getMaxLevel(Skills.SKILL.HITPOINTS) : newHealth);
p.setLastAnimation(new Animation(829));
p.getPackets().sendSkillLevel(Skills.SKILL.HITPOINTS);
});
Server.registerEvent(eatFoodEvent);
}