本文整理汇总了C#中WorldServer.player.Player.getTemporaryAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getTemporaryAttribute方法的具体用法?C# Player.getTemporaryAttribute怎么用?C# Player.getTemporaryAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.getTemporaryAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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());
}
示例3: 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;
}
}
示例4: 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];
//.........这里部分代码省略.........
示例5: 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();
}
示例6: handleRightClickTwo
private void handleRightClickTwo(Player player, Packet packet)
{
int childId = packet.readLEShort();
int interfaceId = packet.readLEShort();
int slot = packet.readLEShort();
int item = packet.readLEShort();
if (slot < 0 || slot > 28 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
SkillHandler.resetAllSkills(player);
if (player.getInventory().getItemInSlot(slot) == item) {
player.getPackets().closeInterfaces();
switch(player.getInventory().getItemInSlot(slot)) {
case 5509: // Small pouch.
player.getPackets().sendMessage("There is " + player.getSmallPouchAmount() + " Pure essence in your small pouch. (holds 3).");
break;
case 5510: // Medium pouch.
player.getPackets().sendMessage("There is " + player.getMediumPouchAmount() + " Pure essence in your medium pouch. (holds 6).");
break;
case 5512: // Large pouch.
player.getPackets().sendMessage("There is " + player.getLargePouchAmount() + " Pure essence in your large pouch. (holds 9).");
break;
case 5514: // Giant pouch.
player.getPackets().sendMessage("There is " + player.getGiantPouchAmount() + " Pure essence in your giant pouch. (holds 12).");
break;
}
}
}
示例7: handlePickupItem
private void handlePickupItem(Player player, Packet packet)
{
int x = packet.readLEShort();
int id = packet.readUShort();
int y = packet.readLEShortA();
Location l = new Location(x, y, player.getLocation().getZ());
SkillHandler.resetAllSkills(player);
if (x < 1000 || y < 1000 | id < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
player.getPackets().closeInterfaces();
if(player.getLocation().Equals(l)) {
Server.getGroundItems().pickupItem(player, id, player.getLocation());
return;
}
CoordinateEvent pickupItemCoordinateEvent = new CoordinateEvent(player, l);
pickupItemCoordinateEvent.setAction(() => {
Server.getGroundItems().pickupItem(player, id, player.getLocation());
});
Server.registerCoordinateEvent(pickupItemCoordinateEvent);
}
示例8: handleItemOnObject
private void handleItemOnObject(Player player, Packet packet)
{
int objectX = packet.readShortA();
int item = packet.readUShort();
int objectY = packet.readLEShort();
int slot = packet.readUShort();
int interfaceId = packet.readLEShort();
int child = packet.readUShort();
int objectId = packet.readShortA();
if (slot > 28 || slot < 0 || player.isDead() || player.getTemporaryAttribute("cantDoAnything") != null) {
return;
}
Console.WriteLine("Item on object = " + objectId + " " + objectX + " " + objectY);
SkillHandler.resetAllSkills(player);
player.getPackets().closeInterfaces();
player.setFaceLocation(new Location(objectX, objectY, player.getLocation().getZ()));
if (player.getInventory().getItemInSlot(slot) == item) {
if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
return;
} else if (Farming.interactWithPatch(player, objectId, objectX, objectY, player.getInventory().getItemInSlot(slot))) {
return;
} else if (WarriorGuild.useAnimator(player, player.getInventory().getItemInSlot(slot), objectId, objectX, objectY)) {
return;
}
if (player.getInventory().getItemInSlot(slot) == 7936) {
if (RuneCraft.wantToRunecraft(player, objectId, objectX, objectY)) {
return;
}
if (RuneCraft.useTalisman(player, objectId, objectX, objectY)) {
return;
}
}
switch(objectId) {
case 6: // Cannon:
DwarfCannon cannon = player.getCannon();
Location l = new Location(objectX, objectY, player.getLocation().getZ());
if (cannon == null || (cannon != null & !l.withinDistance(cannon.getLocation(), 2))) {
player.getPackets().sendMessage("This isn't your cannon!");
break;
}
cannon.loadCannon();
break;
case 36781: // Lumbridge fountain.
case 24214: // Fountain in east Varrock.
case 24265: // Varrock main fountain.
case 11661: // Falador waterpump.
case 11759: // Falador south fountain.
case 879: // Camelot fountains.
case 29529: // Sink.
case 874: // Sink.
if (FillVial.fillingVial(player, new Location(objectX, objectY, player.getLocation().getZ())) && player.getInventory().getItemInSlot(slot) == 229) {
break;
}
break;
case 2728: // Range in Catherby
if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), false, -1, -1)) {
break;
}
break;
case 2732: // Fire
if (Cooking.isCooking(player, player.getInventory().getItemInSlot(slot), true, objectX, objectY)) {
break;
}
break;
case 36956: // Lumbridge furnace
case 11666: // Falador furnace
if (Smelting.wantToSmelt(player, player.getInventory().getItemInSlot(slot))) {
break;
} else if (Crafting.wantsToCraftOnObject(player, player.getInventory().getItemInSlot(slot), objectId)) {
break;
}
break;
case 2783: // Anvil
if (Smithing.wantToSmithOnAnvil(player, player.getInventory().getItemInSlot(slot), new Location(objectX, objectY, player.getLocation().getZ()))) {
break;
}
break;
default:
player.getPackets().sendMessage("Nothing interesting happens.");
break;
}
}
}
示例9: 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.");
}
示例10: 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);
}
}
示例11: 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);
}
}
示例12: 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);
}
}
示例13: 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);
}
}
示例14: 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);
}
}
示例15: 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);
}
}