当前位置: 首页>>代码示例>>C#>>正文


C# Player.getClientIndex方法代码示例

本文整理汇总了C#中WorldServer.player.Player.getClientIndex方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getClientIndex方法的具体用法?C# Player.getClientIndex怎么用?C# Player.getClientIndex使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WorldServer.player.Player的用法示例。


在下文中一共展示了Player.getClientIndex方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: 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);
//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:FightCave.cs

示例2: hitInMulti

 public static void hitInMulti(Player p, Entity mainTarget, int index)
 {
     if (!Location.inMultiCombat(p.getLocation()) || !Location.inMultiCombat(mainTarget.getLocation())) {
         return;
     }
     else if (!hitsMulti(p, index)) {
         return;
     }
     Location l = mainTarget.getLocation();
     double totalDamage = 0;
     if (mainTarget is Npc) {
         foreach(Npc n in Server.getNpcList()) {
             if (n == null || n.Equals(mainTarget) || n.isDead() || n.isHidden() || n.isDestroyed()) {
                 continue;
             }
             if (n.getLocation().inArea(l.getX() - 1, l.getY() - 1, l.getX() + 1, l.getY() + 1)) {
                 if (!canCastSpell2(p, mainTarget, index, false)) {
                     continue;
                 }
                 if (n.isAutoRetaliating() && n.getTarget() == null) {
                     //n.getFollow().setFollowing(killer);
                     n.setEntityFocus(p.getClientIndex());
                     n.setCombatTurns(n.getAttackSpeed() / 2);
                     n.setTarget(p);
                 }
                 int damage = misc.random(misc.random(getSpellMaxHit(p, index))); //double randomize? uhh wtf?
                 int graphic = END_GFX[index];
                 if (damage == 0) {
                     graphic = 85;
                 }
                 if (damage > n.getHp()) {
                     damage = n.getHp();
                 }
                 if (damage > 0) {
                     bool frozen = freezeTarget(index, n);
                     if (!frozen && index == 31) {
                         graphic = 1677;
                     }
                 }
                 totalDamage += damage;
                 n.setAttacker(p);
                 n.setLastAttacked(Environment.TickCount);
                 n.setLastGraphics(new Graphics(graphic, 0, getGroundHeight(index, graphic)));
                 n.hit(damage);
                 if ((n.getCombatTurns() > 2 || n.getCombatTurns() < 0)) {
                     n.setLastAnimation(new Animation(n.getDefenceAnimation()));
                 }
                 addDamage(p, n, damage);
             }
         }
     } else {
         foreach(Player target in Server.getPlayerList()) {
             if (mainTarget == null || target.Equals(mainTarget) || target.isDead() || target.isHidden() || target.isDestroyed()) {
                 continue;
             }
             if (target.getLocation().inArea(l.getX() - 1, l.getY() - 1, l.getX() + 1, l.getY() + 1)) {
                 if (!canCastSpell2(p, mainTarget, index, false)) {
                     continue;
                 }
                 if (target.isAutoRetaliating() && target.getTarget() == null) {
                     //n.getFollow().setFollowing(killer);
                     target.setEntityFocus(p.getClientIndex());
                     target.setCombatTurns(target.getAttackSpeed() / 2);
                     target.setTarget(p);
                 }
                 int damage = misc.random(misc.random(getSpellMaxHit(p, index))); //double randomize? uhh wtf?
                 int graphic = END_GFX[index];
                 if (damage == 0) {
                     graphic = 85;
                 }
                 if (damage > target.getHp()) {
                     damage = target.getHp();
                 }
                 if (damage > 0) {
                     bool frozen = freezeTarget(index, target);
                     if (!frozen && index == 31) {
                         graphic = 1677;
                     }
                 }
                 totalDamage += damage;
                 target.setAttacker(p);
                 target.setLastAttacked(Environment.TickCount);
                 target.setLastGraphics(new Graphics(graphic, 0, getGroundHeight(index, graphic)));
                 target.hit(damage);
                 if ((target.getCombatTurns() > 2 || target.getCombatTurns() < 0)) {
                     target.setLastAnimation(new Animation(target.getDefenceAnimation()));
                 }
                 addDamage(p, target, damage);
             }
         }
     }
     if (totalDamage > 0) {
         addMagicXp(p, null, totalDamage, index, false);
         if (index == 18 || index == 22 || index == 26 || index == 30) {
             p.heal((int) (totalDamage * 0.25));
         }
     }
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:98,代码来源:MagicCombat.cs

示例3: newMagicAttack


//.........这里部分代码省略.........
            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();
                if (p == null || p.isDead() || !fakeNPC && (target.isDead() || target.isHidden() || target.isDestroyed())) {
                    return;
                }
                if (target.isAutoRetaliating() && target.getTarget() == null && damage > 0) {
                    if (target is Npc) {
                    } else {
                        if (((Player) target).getTemporaryAttribute("autoCastSpell") != null) {
                            int autoCastSpell = (int)((Player) target).getTemporaryAttribute("autoCastSpell");
                            ((Player) target).setTemporaryAttribute("autoCasting", true);
                            target.setTarget(p);
                            MagicCombat.newMagicAttack((Player) target, p, autoCastSpell, ((Player) target).getTemporaryAttribute("autoCastAncients") != null);
                        }
                    }
                    target.getFollow().setFollowing(p);
                    target.setEntityFocus(p.getClientIndex());
                    if ((target.getCombatTurns() <= (target.getAttackSpeed() / 2) || target.getCombatTurns() >= (target.getAttackSpeed()))) {
                        target.setCombatTurns(target.getAttackSpeed() / 2);
                    }
                    target.setTarget(p);
                    if (target is Player) {
                        ((Player) target).getWalkingQueue().resetWalkingQueue();
                        ((Player) target).getPackets().clearMapFlag();
                    }
                }
                addMagicXp(p, target, damage, index, true);
                target.setLastGraphics(new Graphics(endGfx, 0, getGroundHeight(index, endGfx)));
                if (index == 47 && endGfx != 85) { // teleblock
                    if (target is Player) {
                        teleblockPlayer(p, (Player)target);
                    }
                }
                if (damage != 0) {
                    Combat.checkRecoil(p, target, damage);
                    Combat.checkSmite(p, target, damage);
                    Combat.checkVengeance(p, target, damage);
                    hitInMulti(p, target, index);
                    applyMiasmicEffects(p, target, index);
                    if ((target.getCombatTurns() > 2 || target.getCombatTurns() < 0) && !target.isDead()) {
                        target.setLastAnimation(new Animation(target.getDefenceAnimation()));
                    }
                    if (index != 27) {
                        target.hit((int)damage);
                        if (index == 18 || index == 22 || index == 26 || index == 30) {
                            p.heal(Convert.ToInt32(damage / 4));
                        }
                    } else if (index == 27){
                        Event doHitEvent = new Event(1000);
                        doHitEvent.setAction(() => {
                                doHitEvent.stop();
                                target.hit((int)damage);
                        });
                        Server.registerEvent(doHitEvent);
                    }
                }
            });
            Server.registerEvent(doMagicAttackEvent);
            if (p.getTemporaryAttribute("autoCasting") != null) {
                if (p.getTemporaryAttribute("autoCastSpell") != null) {
                    if (id != (int)p.getTemporaryAttribute("autoCastSpell")) {
                        p.setTarget(null);
                        return;
                    }
                }
                if (!fakeNPC) {
                    p.setTemporaryAttribute("autocastLocation", target.getLocation());
                    p.setTemporaryAttribute("autocastEntity", target);
                }
                Event autoCastSpellEvent = new Event(3500);
                autoCastSpellEvent.setAction(() => {
                    autoCastSpellEvent.stop();
                    if (p.getTemporaryAttribute("autoCasting") != null && p.getTemporaryAttribute("autoCastSpell") != null) {
                        int autoCastSpell = (int)p.getTemporaryAttribute("autoCastSpell");
                        MagicCombat.newMagicAttack(p, p.getTarget(), autoCastSpell, p.getTemporaryAttribute("autoCastAncients") != null);
                    }
                });
                Server.registerEvent(autoCastSpellEvent);
            } else {
                p.setTarget(null);
            }
        }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:MagicCombat.cs

示例4: openCoffin

 public static bool openCoffin(Player p, int objectId)
 {
     if (objectId != 6823 && objectId != 6771 && objectId != 6821 && objectId != 6773 && objectId != 6822 && objectId != 6772) {
         return false;
     }
     int cryptIndex = getCryptIndex(p);
     if (cryptIndex == -1) {
         return false;
     }
     if (p.getBarrowBrothersKilled(cryptIndex)) {
         p.getPackets().sendMessage("You don't find anything.");
         return true;
     }
     if (p.getBarrowTunnel() == cryptIndex){
         p.getPackets().modifyText("You find a hidden tunnel, do you want to enter?", 210, 1);
         p.getPackets().sendChatboxInterface(210);
         p.setTemporaryAttribute("barrowTunnel", 1);
         return true;
     }
     foreach(Npc n in Server.getNpcList()) {
         if (n.getId() == BROTHER_ID[cryptIndex]) {
             if (n.getOwner().Equals(p)) {
                 p.getPackets().sendMessage("You don't find anything.");
                 return true;
             }
         }
     }
     Npc npc = new Npc(BROTHER_ID[cryptIndex]);
     npc.setLocation(p.getLocation());
     npc.setEntityFocus(p.getClientIndex());
     npc.setOwner(p);
     npc.setTarget(p);
     npc.setCombatTurns(npc.getAttackSpeed());
     Server.getNpcList().Add(npc);
     p.getPackets().setArrowOnEntity(1, npc.getClientIndex());
     return true;
 }
开发者ID:Krill156,项目名称:SharpEMU,代码行数:37,代码来源:Barrows.cs


注:本文中的WorldServer.player.Player.getClientIndex方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。