Ejemplo n.º 1
0
 private void HandlePlayerDied(object sender, DiedEventArgs e)
 {
     if (e.X == this.x && e.Y == this.y && e.Z == this.z)
     {
         if (sender == this.combatTarget)
         {
             //this.combatTarget = null;
             this.inCombat = false;
             this.writeToClient(e.DefenderName + " collapsed... DEAD!\r\n");
         }
         else
         {
             this.writeToClient(e.AttackerName + " slays " + e.DefenderName + "\r\n");
         }
     }
 }
Ejemplo n.º 2
0
        protected void OnDied(DiedEventArgs e)
        {
            EventHandler<DiedEventArgs> handler = this.Died;

            if (handler != null)
            {
                handler(this, e);
            }
        }
Ejemplo n.º 3
0
        private void HandleNPCDied(object sender, DiedEventArgs e)
        {
            if (e.X == this.x && e.Y == this.y && e.Z == this.z)
            {
                if (sender == this.combatTarget)
                {
                    //this.combatTarget = null;
                    //TODO: extract this into a helper method so that handleplayerdied can call it too to keep this DRY
                    double baseXp = Math.Ceiling(Math.Sqrt(Math.Pow(Convert.ToDouble(this.combatTarget.Level) * 5000.0, 1.0 + (Convert.ToDouble(this.combatTarget.Level) / 100.0))));
                    int adjustedXp = Convert.ToInt32(Math.Ceiling(baseXp * (Convert.ToDouble(this.combatTarget.Level) / Convert.ToDouble(this.level))));

                    this.inCombat = false;
                    this.writeToClient(e.DefenderName + " collapsed... DEAD!\r\nYour share of the experience is " + adjustedXp + " points.\r\n");

                    this.currentLevelExp += adjustedXp;
                    this.totalExperience += adjustedXp;

                    if (this.level < 100)
                    {
                        if (this.currentLevelExp >= expChart.ExpChart[this.level+1])
                        {
                            this.LevelUp();
                        }
                    }
                }
                else
                {
                    this.writeToClient(e.AttackerName + " slays " + e.DefenderName + "\r\n");
                }
            }
        }