本文整理汇总了C#中RunescapeServer.player.Player.getTemporaryAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getTemporaryAttribute方法的具体用法?C# Player.getTemporaryAttribute怎么用?C# Player.getTemporaryAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RunescapeServer.player.Player
的用法示例。
在下文中一共展示了Player.getTemporaryAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: useJewellery
public static bool useJewellery(Player p, int item, int slot, bool wearingItem) {
if (item == 1704 || item == 10362) { // Blank amulets
p.getPackets().sendMessage("This amulet has no charges remaining.");
return true;
}
if (p.getTemporaryAttribute("unmovable") != null || p.getTemporaryAttribute("cantDoAnything") != null) {
return true;
}
int index = getItemIndex(item);
if (index == -1) {
return false;
}
string s = index == 2 ? "ring" : "amulet";
p.getPackets().sendMessage("You rub the " + s + "...");
p.getPackets().closeInterfaces();
int interfaceId = index == 2 ? 230 : 235;
int j = 2;
p.getPackets().modifyText("Teleport to where?", interfaceId, 1);
for (int i = 0; i < LOCATIONS[index].Length; i++) {
p.getPackets().modifyText(LOCATIONS[index][i], interfaceId, (i + j));
}
if (index == 2) {
p.getPackets().sendChatboxInterface2(interfaceId);
} else {
p.getPackets().sendChatboxInterface2(interfaceId);
}
JewellerySlot js = new JewelleryTeleport.JewellerySlot(index, slot, wearingItem);
p.setTemporaryAttribute("jewelleryTeleport", js);
return true;
}
示例2: 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;
}
示例3: createdAnimatedArmour
protected static void createdAnimatedArmour(Player p, int index) {
if (p.getTemporaryAttribute("warriorGuildAnimator") == null) {
return;
}
p.setLastAnimation(new Animation(827));
p.setTemporaryAttribute("unmovable", true);
for (int i = 0; i < ARMOUR_SETS[index].Length; i++) {
p.getInventory().deleteItem(ARMOUR_SETS[index][i]);
}
p.getPackets().sendChatboxInterface(211);
p.getPackets().modifyText("You place the armour onto the platform where it", 211, 1);
p.getPackets().modifyText("dissapears...", 211, 2);
int animatorIndex = (int) p.getTemporaryAttribute("warriorGuildAnimator");
Event createAnimatedArmourEvent = new Event(1500);
int createAnimatedArmourCounter = 0;
Npc npc = null;
createAnimatedArmourEvent.setAction(() => {
if (createAnimatedArmourCounter == 0)
{
p.getPackets().sendChatboxInterface(211);
p.getPackets().modifyText("The animator hums, something appears to be working.", 211, 1);
p.getPackets().modifyText("You stand back.", 211, 2);
createAnimatedArmourEvent.setTick(500);
}
else if (createAnimatedArmourCounter == 1)
{
p.getWalkingQueue().forceWalk(0, + 3);
createAnimatedArmourEvent.setTick(2000);
}
else if (createAnimatedArmourCounter == 2)
{
createAnimatedArmourEvent.setTick(500);
Location minCoords = new Location(2849, 3534, 0);
Location maxCoords = new Location(2861, 3545, 0);
npc = new Npc(ANIMATED_ARMOUR[index]);
npc.setMinimumCoords(minCoords);
npc.setMaximumCoords(maxCoords);
npc.setLocation(new Location(ANIMATOR_LOCATIONS[animatorIndex][0], ANIMATOR_LOCATIONS[animatorIndex][1], 0));
npc.setWalkType(WalkType.STATIC);
npc.setForceText("I'm ALIVE!");
npc.setLastAnimation(new Animation(4166));
npc.setEntityFocus(p.getClientIndex());
npc.setOwner(p);
npc.setTarget(p);
p.getPackets().setArrowOnEntity(1, npc.getClientIndex());
Server.getNpcList().Add(npc);
} else {
p.setEntityFocus(npc.getClientIndex());
p.getPackets().softCloseInterfaces();
createAnimatedArmourEvent.stop();
p.removeTemporaryAttribute("unmovable");
npc.getFollow().setFollowing(p);
}
createAnimatedArmourCounter++;
});
Server.registerEvent(createAnimatedArmourEvent);
}
示例4: handlePacket
public void handlePacket(Player player, Packet packet) {
int size = packet.getLength();
if(packet.getPacketId() == PacketHandlers.PacketId.WALK_2) {
size -= 14;
}
player.getWalkingQueue().resetWalkingQueue();
int steps = (size - 5) / 2;
if (steps > WalkingQueue.MAX_WALKING_WAYPOINTS)
{
misc.WriteError("Warning: Walk command contains too many steps (" + steps + ") currently set to 50 [maybe need increase?]");
return;
}
player.getWalkingQueue().setIsRunning(packet.readByteA() == 1);
bool following = false;
if (!canWalk(player, packet, following))
{
player.getPackets().clearMapFlag();
player.getWalkingQueue().resetWalkingQueue();
return;
}
int firstX = packet.readUShort() - (player.getLocation().getRegionX() - 6) * 8;
int firstY = packet.readShortA() - (player.getLocation().getRegionY() - 6) * 8;
player.getWalkingQueue().addToWalkingQueue(firstX, firstY);
for (int i = 0; i < steps; i++) //all the waypoints.
player.getWalkingQueue().addToWalkingQueue((packet.readByteA() + firstX), (packet.readByteS() + firstY));
if (player.getTeleportTo() != null) //is teleporting?
player.getWalkingQueue().resetWalkingQueue();
if (player.getTemporaryAttribute("homeTeleporting") != null) {
player.removeTemporaryAttribute("homeTeleporting");
}
SkillHandler.resetAllSkills(player);
if (player.getTrade() != null)
player.getTrade().decline();
if (player.getDuel() != null) {
if (player.getDuel().getStatus() < 4)
player.getDuel().declineDuel();
else if (player.getDuel().getStatus() == 8)
player.getDuel().recieveWinnings(player);
}
if (player.getTarget() != null) {
if (!following && player.getTarget().getAttacker() != null && player.getTarget().getAttacker().Equals(player))
player.getTarget().setAttacker(null);
}
if (!following) {
player.getFollow().setFollowing(null);
player.setTarget(null);
player.removeTemporaryAttribute("autoCasting");
if (player.getEntityFocus() != 65535)
player.setEntityFocus(65535);
}
player.getPackets().closeInterfaces();
}
示例5: showCanifisSailorDialogue
public static void showCanifisSailorDialogue(Player p, int status) {
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 280:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 281;
break;
case 281:
p.getPackets().sendNPCHead(1304, 241, 2);
p.getPackets().modifyText("Sailor", 241, 3);
p.getPackets().modifyText("As you wish, i'll fetch the boat.", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 282;
break;
case 282:
travel(p, 0, true);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}
示例6: 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++;
}
}
示例7: leverTeleport
public static void leverTeleport(Player p, int option) {
p.getPackets().closeInterfaces();
Location teleLocation = new Location(LEVER_COORDINATES[option][0], LEVER_COORDINATES[option][1], LEVER_COORDINATES[option][2]);
Event leverTeleportEvent = new Event(200);
leverTeleportEvent.setAction(() => {
leverTeleportEvent.stop();
if (p.getTemporaryAttribute("teleblocked") != null) {
p.getPackets().sendMessage("A magical force prevents you from teleporting!");
return;
} else if ((p.getTemporaryAttribute("teleporting") != null )) {
return;
}
p.setLastAnimation(new Animation(2140));
p.getPackets().closeInterfaces();
p.setTemporaryAttribute("teleporting", true);
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
SkillHandler.resetAllSkills(p);
Event levelTeleportStartEvent = new Event(700);
levelTeleportStartEvent.setAction(() => {
levelTeleportStartEvent.stop();
p.setLastAnimation(new Animation(8939, 0));
p.setLastGraphics(new Graphics(1576, 0));
Event levelTeleportFinishEvent = new Event(1800);
levelTeleportFinishEvent.setAction(() => {
levelTeleportFinishEvent.stop();
p.teleport(teleLocation);
p.setLastAnimation(new Animation(8941, 0));
p.setLastGraphics(new Graphics(1577, 0));
Teleport.resetTeleport(p);
});
Server.registerEvent(levelTeleportFinishEvent);
});
Server.registerEvent(levelTeleportStartEvent);
});
Server.registerEvent(leverTeleportEvent);
}
示例8: handleFirstClickNPC
private void handleFirstClickNPC(Player player, Packet packet) {
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;
}
Console.WriteLine("First click NPC " + npc.getId());
SkillHandler.resetAllSkills(player);
Combat.newAttack(player, npc);
}
示例9: 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());
player.setFaceLocation(npc.getLocation());
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;
}
}
示例10: 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
}
示例11: showBentleyDialogue
public static void showBentleyDialogue(Player p, int status) {
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 240:
p.getPackets().sendNPCHead(4540, 241, 2);
p.getPackets().modifyText("Captain Bentley", 241, 3);
p.getPackets().modifyText("Well, hello there " + p.getLoginDetails().getUsername() + ", ready to set sail?", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 241;
break;
case 241:
p.getPackets().modifyText("I'd like to travel to..", 235, 1);
p.getPackets().modifyText("Canifis", 235, 2);
p.getPackets().modifyText("Waterbirth Isle", 235, 3);
p.getPackets().modifyText("Pest Control", 235, 4);
p.getPackets().modifyText("Warrior Guild", 235, 5);
p.getPackets().modifyText("Fremmenik Shore", 235, 6);
p.getPackets().sendChatboxInterface2(235);
newStatus = 242;
break;
case 242: // Canifis
travel(p, 0, false);
break;
case 243: // Waterbirth isle
travel(p, 1, false);
break;
case 244: // Pest control
travel(p, 2, false);
break;
case 245: // Warrior guild
int attackLevel = p.getSkills().getMaxLevel(Skills.SKILL.ATTACK);
int strengthLevel = p.getSkills().getMaxLevel(Skills.SKILL.STRENGTH);
bool hasA99 = attackLevel == 99 || strengthLevel == 99;
if (((attackLevel + strengthLevel) >= 130) || hasA99) {
travel(p, 3, false);
} else {
p.getPackets().sendNPCHead(4540, 243, 2);
p.getPackets().modifyText("Captain Bentley", 243, 3);
p.getPackets().modifyText("I'm sorry " + p.getLoginDetails().getUsername() + ", I cannot take you there.", 243, 4);
p.getPackets().modifyText("A combined Attack & Strength level of 130 is ", 243, 5);
p.getPackets().modifyText("required to use The Warrior Guild.", 243, 6);
p.getPackets().animateInterface(9827, 243, 2);
p.getPackets().sendChatboxInterface2(243);
}
break;
case 246: // Fremmenik shore
travel(p, 4, false);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}
示例12: showCaptainBarnabyDialogue
public static void showCaptainBarnabyDialogue(Player p, int status) {
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 410:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 411;
break;
case 411:
p.getPackets().sendNPCHead(4962, 241, 2);
p.getPackets().modifyText("Captain Barnaby", 241, 3);
p.getPackets().modifyText("Yes! it's freezing here, let's go!", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 412;
break;
case 412:
travel(p, 4, true);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}
示例13: showArnorDialogue
public static void showArnorDialogue(Player p, int status) {
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 370:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 371;
break;
case 371:
p.getPackets().sendNPCHead(1361, 241, 2);
p.getPackets().modifyText("Arnor", 241, 3);
p.getPackets().modifyText("Of course, follow me.", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 372;
break;
case 372:
travel(p, 3, true);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}
示例14: showSquireDialogue
public static void showSquireDialogue(Player p, int status) {
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 340:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 341;
break;
case 341:
p.getPackets().sendNPCHead(3781, 241, 2);
p.getPackets().modifyText("Squire", 241, 3);
p.getPackets().modifyText("Certainly! Please visit Pest Control again soon.", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 342;
break;
case 342:
travel(p, 2, true);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}
示例15: showJarvaldDialogue
public static void showJarvaldDialogue(Player p, int status) {
int newStatus = -1;
p.getPackets().softCloseInterfaces();
if (p.getTemporaryAttribute("unmovable") != null) {
return;
}
switch(status) {
case 300:
p.getPackets().sendPlayerHead(64, 2);
p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
p.getPackets().modifyText("Could you take me back to Oo'glog please?", 64, 4);
p.getPackets().animateInterface(9827, 64, 2);
p.getPackets().sendChatboxInterface2(64);
newStatus = 301;
break;
case 301:
p.getPackets().sendNPCHead(2436, 241, 2);
p.getPackets().modifyText("Jarvald", 241, 3);
p.getPackets().modifyText("No problem. Off we go!", 241, 4);
p.getPackets().animateInterface(9827, 241, 2);
p.getPackets().sendChatboxInterface2(241);
newStatus = 302;
break;
case 302:
travel(p, 1, true);
break;
}
if (newStatus != -1) {
p.setTemporaryAttribute("dialogue", newStatus);
}
}