本文整理汇总了C#中WorldServer.player.Player.setLastGraphics方法的典型用法代码示例。如果您正苦于以下问题:C# Player.setLastGraphics方法的具体用法?C# Player.setLastGraphics怎么用?C# Player.setLastGraphics使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WorldServer.player.Player
的用法示例。
在下文中一共展示了Player.setLastGraphics方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
});
//.........这里部分代码省略.........
示例3: 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);
//.........这里部分代码省略.........
示例4: newMagicAttack
//.........这里部分代码省略.........
p.setLastCombatType(Combat.CombatType.MAGE);
return;
}
if (fakeNPC && !monsterInArea(p, target)) {
p.removeTemporaryAttribute("autoCasting");
Combat.resetCombat(p, 1);
return;
}
int endGfx = END_GFX[index];
double damage = misc.random(CombatFormula.getMagicHit(p, target, getSpellMaxHit(p, index)));
bool mp = false;
bool magicProtect = mp;
if (target is Player) {
mp = ((Player) target).getPrayers().getHeadIcon() == PrayerData.MAGIC;
}
if (magicProtect) {
damage *= 0.60;
}
if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841) {
damage *= 1.10; // void mace 10% hit increase.
}
if (damage == 0 && index != 41 && index != 42 && index != 43 && index != 44 && index != 45 && index != 46 && index != 47) {
endGfx = 85;
}
if (!deleteRunes(p, RUNES[index], RUNE_AMOUNTS[index])) {
p.setTarget(null);
return;
}
p.getFollow().setFollowing(null);
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
p.setFaceLocation(target.getLocation());
if (HANDS_GFX[index] != -1) {
p.setLastGraphics(new Graphics(HANDS_GFX[index], 0 , getStartingGraphicHeight(index)));
}
p.setLastAnimation(new Animation(SPELL_ANIM[index]));
p.getPackets().closeInterfaces();
if (target is Player) {
((Player) target).getPackets().closeInterfaces();
}
target.setAttacker(p);
p.setTarget(target);
target.setLastAttacked(Environment.TickCount);
p.setLastAttack(Environment.TickCount);
p.setLastMagicAttack(Environment.TickCount);
p.setCombatTurns(p.getAttackSpeed());
Combat.setSkull(p, target);
if (damage > 0) {
frozen = freezeTarget(index, target);
if (!frozen && index == 31) {
endGfx = 1677;
}
}
if (AIR_GFX[index] != -1 || ((index == 31 || index == 27) && target is Player && ((Player)target).getWalkingQueue().isRunning())) {
sendProjectile(index, target, p);
}
if (damage > target.getHp()) {
damage = target.getHp();
}
if (index == 47 && misc.random(2) == 0) {
endGfx = 85;
}
Combat.checkIfWillDie(target, damage);
Event doMagicAttackEvent = new Event(getSpellHitDelay(index));
doMagicAttackEvent.setAction(() => {
doMagicAttackEvent.stop();
示例5: useLever
public static void useLever(Player p, int id, Location leverLocation)
{
if (p.getTemporaryAttribute("teleporting") != null)
{
return;
}
foreach (LoadedLaddersAndStairs.Lever lever in LoadedLaddersAndStairs.levers)
{
if (lever.getId() == id)
{
if (lever.getLeverLocation().Equals(leverLocation))
{
LoadedLaddersAndStairs.Lever l = lever;
//TODO when in use it cant be used (in use = lever is facing down)
CoordinateEvent useLeverCoordinateEvent = new CoordinateEvent(p, l.getLeverLocation());
useLeverCoordinateEvent.setAction(() =>
{
p.setFaceLocation(l.getFaceLocation());
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);
l.setInUse(true);
Event useLeverEvent = new Event(700);
useLeverEvent.setAction(() =>
{
useLeverEvent.stop();
p.setLastAnimation(new Animation(8939, 0));
p.setLastGraphics(new Graphics(1576, 0));
l.setInUse(false);
Event setLeverTeleportEvent = new Event(1800);
setLeverTeleportEvent.setAction(() =>
{
setLeverTeleportEvent.stop();
p.teleport(l.getTeleLocation());
p.setLastAnimation(new Animation(8941, 0));
p.setLastGraphics(new Graphics(1577, 0));
Teleport.resetTeleport(p);
});
Server.registerEvent(setLeverTeleportEvent);
});
Server.registerEvent(useLeverEvent);
});
Server.registerCoordinateEvent(useLeverCoordinateEvent);
break;
}
}
}
}