コード例 #1
0
ファイル: Entity.cs プロジェクト: Rut0/RSPS-CSharp
 public void processQueuedHits()
 {
     // kinda messy.
     if (this is Player)
     {
         if (!((Player)this).getUpdateFlags().isHitUpdateRequired())
         {
             if (queuedHits.Count() > 0)
             {
                 Hits.Hit h = queuedHits.Dequeue();
                 hit(h.getDamage(), h.getType());
             }
         }
         if (!((Player)this).getUpdateFlags().isHit2UpdateRequired())
         {
             if (queuedHits.Count() > 0)
             {
                 Hits.Hit h = queuedHits.Dequeue();
                 hit(h.getDamage(), h.getType());
             }
         }
     }
     else
     {
         if (!((Npc)this).getUpdateFlags().isHitUpdateRequired())
         {
             if (queuedHits.Count() > 0)
             {
                 Hits.Hit h = queuedHits.Dequeue();
                 hit(h.getDamage(), h.getType());
             }
         }
         if (!((Npc)this).getUpdateFlags().isHit2UpdateRequired())
         {
             if (queuedHits.Count() > 0)
             {
                 Hits.Hit h = queuedHits.Dequeue();
                 hit(h.getDamage(), h.getType());
             }
         }
     }
 }
コード例 #2
0
ファイル: TestDamage.cs プロジェクト: ramatronics/rsps
        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[Test Damage command]: ::testdmg dmg  ::testdmg 2000");
                return;
            }

            int dmg = 0;
            Hits.Hit hit;
            if (!int.TryParse(arguments[0], out dmg))
            {
                dmg = 0;
                hit = new Hits.Hit(dmg, Hits.HitType.NO_DAMAGE);
            }
            else
            {
                hit = new Hits.Hit(dmg, Hits.HitType.NORMAL_DAMAGE);
            }

            player.getHits().setHit1(hit);
            player.getUpdateFlags().setHitUpdateRequired(true);
        }