Esempio n. 1
0
 protected virtual void OnMonsterKilled(MonsterKilledEventArgs e)
 {
     if (MonsterKilled != null)
     {
         MonsterKilled(this, e);
     }
 }
Esempio n. 2
0
        private MonsterKilledEventArgs OnMonsterKilledForOut()
        {
            MonsterKilledEventArgs args = new MonsterKilledEventArgs();

            OnMonsterKilled(args);

            return(args);
        }
Esempio n. 3
0
        private MonsterKilledEventArgs OnMonsterKilled(Monster monster)
        {
            MonsterKilledEventArgs args = new MonsterKilledEventArgs(monster);

            OnMonsterKilled(args);

            return(args);
        }
Esempio n. 4
0
 public void OnCustomerEvent(MonsterKilledEventArgs e)
 {
     CustomerEvent?.Invoke(this, e);
 }
Esempio n. 5
0
        public MapleCharacter KillBy(MapleCharacter killer)
        {
            long totalBaseExpL;

            // update exp
            //if (killer.inTutorialMap())
            //{
            //    totalBaseExpL = Stats.Exp*killer.Client.ChannelServer.ExpRate; /** killer.hasEXPCard();*/
            //}
            //else
            //{
            totalBaseExpL = Stats.Exp * killer.Client.ChannelServer.ExpRate;
            /** killer.getClient().getPlayer().hasEXPCard();*/
            //}

            var            totalBaseExp = (int)Math.Min(int.MaxValue, totalBaseExpL);
            IAttackerEntry highest      = null;
            var            highdamage   = 0;

            foreach (var attackEntry in m_attackers)
            {
                if (attackEntry.GetDamage() > highdamage)
                {
                    highest    = attackEntry;
                    highdamage = attackEntry.GetDamage();
                }
            }

            foreach (var attackEntry in m_attackers)
            {
                var baseExp = (int)Math.Ceiling(totalBaseExp * ((double)attackEntry.GetDamage() / MaxHp));
                attackEntry.KilledMob(killer.Map, baseExp, attackEntry == highest);
            }

            if (GetController() != null)
            {
                // this can/should only happen when a hidden gm attacks the monster
                GetController().Client.Send(PacketCreator.StopControllingMonster(ObjectId));
                GetController().StopControllingMonster(this);
            }
            if (IsBoss)
            {
                //killer.finishAchievement(6);
            }

            var toSpawn = Stats.Revives;

            var canSpawn = true;

            if (EventInstanceManager != null)
            {
                if (EventInstanceManager.Name.IndexOf("BossQuest", 0, StringComparison.Ordinal) != -1)
                {
                    canSpawn = false;
                }
            }

            if (toSpawn != null && canSpawn)
            {
                var reviveMap = killer.Map;

                TimerManager.Instance.RunOnceTask(() =>
                {
                    foreach (var mid in toSpawn)
                    {
                        var mob = MapleLifeFactory.GetMonster(mid);
                        EventInstanceManager?.RegisterMonster(mob);
                        mob.Position = Position;
                        //if (dropdisabled)
                        //    mob.dropdisabled;
                        reviveMap.SpawnRevives(mob);
                    }
                }, Stats.GetAnimationTime("die1"));
            }
            if (EventInstanceManager != null)
            {
                //EventInstanceManager.unregisterMonster(this);
            }
            foreach (var listener in Listeners)
            {
                var arg = new MonsterKilledEventArgs {
                    Monster = this, HighestDamageChar = m_highestDamageChar
                };
                listener(this, arg);
            }
            var ret = m_highestDamageChar;

            m_highestDamageChar = null; // may not keep hard references to chars outside of PlayerStorage or MapleMap
            return(ret);
        }