public override void OnDeath(Container c) { base.OnDeath(c); if (!c.Deleted) { while (c.Items.Count > 0) c.Items[0].MoveToWorld(c.Location, c.Map); c.Delete(); } }
public override void OnDeath(Container c) { base.OnDeath(c); List<Item> list = new List<Item>(); foreach (Item item in c.Items) list.Add(item); foreach (Item item in list) item.MoveToWorld(c.Location, c.Map); c.Delete(); }
public override void OnDeath( Container c ) { base.OnDeath( c ); c.Delete(); }
protected override void OnAfterDeath( Container c ) { MeerMage.StopEffect( this, false ); ArcaneEmpowermentSpell.StopBuffing( this, false ); if ( IsBonded ) { int sound = this.GetDeathSound(); if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); Warmode = false; Poison = null; Combatant = null; BleedAttack.EndBleed( this, false ); Spells.Necromancy.StrangleSpell.RemoveCurse( this ); Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ProcessDeltaQueue(); this.SendIncomingPacket(); this.SendIncomingPacket(); List<AggressorInfo> aggressors = this.Aggressors; for ( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = aggressors[i]; if ( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } List<AggressorInfo> aggressed = this.Aggressed; for ( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = aggressed[i]; if ( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } CheckStatTimers(); } else { if ( !Summoned && !m_NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; for ( int i = 0; i < this.DamageEntries.Count; i++ ) { DamageEntry entry = this.DamageEntries[i]; if ( !entry.HasExpired && entry.DamageGiven > ( this.HitsMax / 10 ) ) { if ( entry.Damager is VoidCreature ) ( (VoidCreature) entry.Damager ).OnKill( this ); } } List<DamageStore> list = GetLootingRights( this.DamageEntries, this.HitsMax ); bool givenQuestKill = false; bool givenFactionKill = false; bool givesLoyaltyAward = ( LoyaltyPointsAward > 0 ); LoyaltyGroupInfo loyaltyGroup = LoyaltyGroupInfo.GetInfo( LoyaltyGroupEnemy ); for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = list[i]; if ( !ds.HasRight ) continue; Titles.AwardFame( ds.Mobile, totalFame, true ); Titles.AwardKarma( ds.Mobile, totalKarma, true ); OnKilledBy( ds.Mobile ); if ( !givenFactionKill ) { givenFactionKill = true; Faction.HandleDeath( this, ds.Mobile ); } if ( givenQuestKill ) continue; PlayerMobile pm = ds.Mobile as PlayerMobile; if ( pm != null ) { QuestSystem qs = pm.Quest; if ( qs != null ) { qs.OnKill( this, c ); givenQuestKill = true; } QuestHelper.CheckCreature( pm, this ); if ( this is WeakSkeleton ) pm.CheckKRStartingQuestStep( 19 ); if ( givesLoyaltyAward && ( loyaltyGroup.Checker == null || loyaltyGroup.Checker( pm, this ) ) ) { // TODO: guessing here, check the real formula @ OSI. int loyaltyPoints = LoyaltyPointsAward / ( i + 1 ); if ( loyaltyPoints > 0 ) { pm.LoyaltyInfo.Award( LoyaltyGroupEnemy, loyaltyPoints ); // Your loyalty to ~1_GROUP~ has increased by ~2_AMOUNT~ pm.SendLocalizedMessage( 1115920, String.Format( "#{0}\t{1}", loyaltyGroup.GroupName.ToString(), loyaltyPoints.ToString() ), 0x21 ); } } } } Renowned.CheckDropReward( this, c ); ( (Corpse) c ).AssignInstancedLoot(); } base.OnAfterDeath( c ); if ( DeleteCorpseOnDeath ) c.Delete(); } }
public override void OnDeath(Container c) { MeerMage.StopEffect(this, false); if (IsBonded) { int sound = GetDeathSound(); if (sound >= 0) { Effects.PlaySound(this, Map, sound); } Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); var aggressors = Aggressors; for (int i = 0; i < aggressors.Count; ++i) { AggressorInfo info = aggressors[i]; if (info.Attacker.Combatant == this) { info.Attacker.Combatant = null; } } var aggressed = Aggressed; for (int i = 0; i < aggressed.Count; ++i) { AggressorInfo info = aggressed[i]; if (info.Defender.Combatant == this) { info.Defender.Combatant = null; } } Mobile owner = ControlMaster; if (owner == null || owner.Deleted || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) || !InLOS(owner)) { if (OwnerAbandonTime == DateTime.MinValue) { OwnerAbandonTime = DateTime.UtcNow; } } else { OwnerAbandonTime = DateTime.MinValue; } GiftOfLifeSpell.HandleDeath(this); CheckStatTimers(); } else { if (!Summoned && !m_NoKillAwards) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; if (Map == Map.Felucca) { totalFame += ((totalFame / 10) * 3); totalKarma += ((totalKarma / 10) * 3); } var list = GetLootingRights(); var titles = new List<Mobile>(); var fame = new List<int>(); var karma = new List<int>(); bool givenQuestKill = false; bool givenFactionKill = false; bool givenToTKill = false; bool givenVASKill = false; for (int i = 0; i < list.Count; ++i) { DamageStore ds = list[i]; if (!ds.m_HasRight) { continue; } if (GivesFameAndKarmaAward) { Party party = Engines.PartySystem.Party.Get(ds.m_Mobile); if (party != null) { int divedFame = totalFame / party.Members.Count; int divedKarma = totalKarma / party.Members.Count; for (int j = 0; j < party.Members.Count; ++j) { PartyMemberInfo info = party.Members[j]; if (info != null && info.Mobile != null) { int index = titles.IndexOf(info.Mobile); if (index == -1) { titles.Add(info.Mobile); fame.Add(divedFame); karma.Add(divedKarma); } else { fame[index] += divedFame; karma[index] += divedKarma; } } } } else { titles.Add(ds.m_Mobile); fame.Add(totalFame); karma.Add(totalKarma); } } OnKilledBy(ds.m_Mobile); XmlQuest.RegisterKill(this, ds.m_Mobile); if (!givenFactionKill) { givenFactionKill = true; Faction.HandleDeath(this, ds.m_Mobile); } Region region = ds.m_Mobile.Region; if (!givenToTKill && (Map == Map.Tokuno || region.IsPartOf("Yomotsu Mines") || region.IsPartOf("Fan Dancer's Dojo"))) { givenToTKill = true; TreasuresOfTokuno.HandleKill(this, ds.m_Mobile); } if (!givenVASKill && (Map == Map.Felucca || region.IsPartOf("Covetous") || region.IsPartOf("Deceit") || region.IsPartOf("Despise") || region.IsPartOf("Destard") || region.IsPartOf("Hythloth") || region.IsPartOf("Shame") || region.IsPartOf("Wrong"))) { givenVASKill = true; VirtueArtifactsSystem.HandleKill(this, ds.m_Mobile); } if (region.IsPartOf("Doom Gauntlet") || region.Name == "GauntletRegion") { DemonKnight.HandleKill(this, ds.m_Mobile); } Server.Engines.Points.PointsSystem.HandleKill(this, ds.m_Mobile, i); PlayerMobile pm = ds.m_Mobile as PlayerMobile; if (pm != null) { QuestHelper.CheckCreature(pm, this); // This line moved up... if (givenQuestKill) { continue; } QuestSystem qs = pm.Quest; if (qs != null) { qs.OnKill(this, c); givenQuestKill = true; } } } for (int i = 0; i < titles.Count; ++i) { Titles.AwardFame(titles[i], fame[i], true); Titles.AwardKarma(titles[i], karma[i], true); } } base.OnDeath(c); if (DeleteCorpseOnDeath) { c.Delete(); } } }
protected override void OnAfterDeath( Container c ) { base.OnAfterDeath( c ); c.Delete(); }
public override void OnDeath( Container c ) { if ( !Summoned && !m_NoKillAwards ) { // note creatures with neg karma GIVE us karma, so these numbers are negated ArrayList list = GetLootingRights( this.DamageEntries ); for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = (DamageStore)list[i]; if ( !ds.m_HasRight ) continue; Mobile mob = ds.m_Mobile; if ( mob is BaseCreature ) { BaseCreature bc = (BaseCreature)mob; if ( bc.Controled && bc.ControlMaster != null ) mob = bc.ControlMaster; else if ( bc.Summoned && bc.SummonMaster != null ) mob = bc.SummonMaster; } int noto = Notoriety.Compute( mob, this ); if ( noto == Notoriety.Innocent ) Titles.AlterNotoriety( mob, -8 ); else if ( noto == Notoriety.Murderer ) Titles.AlterNotoriety( mob, 1 ); // cap the gain/loss at the npc's karma?? (so killing a 0 karma npc only takes you to 0) } } base.OnDeath( c ); if ( DeleteCorpseOnDeath ) { c.Delete(); } else if ( this is WaterElemental || this is FireElemental || this is AirElemental || this is PoisonElemental || this is BloodElemental ) { Backpack pack = new Backpack(); this.Corpse = pack; pack.MoveToWorld( c.Location, c.Map ); while ( c.Items.Count > 0 ) pack.DropItem( (Item)c.Items[0] ); c.Delete(); } }
public override void OnDeath( Container c ) { BodyMod = 0; if( IsBonded ) { int sound = this.GetDeathSound(); if( sound >= 0 ) Effects.PlaySound(this, this.Map, sound); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); List<AggressorInfo> aggressors = this.Aggressors; for( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = aggressors[i]; if( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } List<AggressorInfo> aggressed = this.Aggressed; for( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = aggressed[i]; if( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange(this, 12) || !this.CanSee(owner) || !this.InLOS(owner) ) { if( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } CheckStatTimers(); } else { if( !Summoned && !m_NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; List<DamageStore> list = GetLootingRights(this.DamageEntries, this.HitsMax); for( int i = 0; i < list.Count; ++i ) { DamageStore ds = list[i]; if( !ds.m_HasRight ) continue; Titles.AwardFame(ds.m_Mobile, totalFame, true); Titles.AwardKarma(ds.m_Mobile, totalKarma, true); OnKilledBy(ds.m_Mobile); } } if (AreSurroundingPlayers) DeleteCorpseOnDeath = false; if (!(AreSurroundingPlayers)) DeleteCorpseOnDeath = true; base.OnDeath(c); if( DeleteCorpseOnDeath ) c.Delete(); } }
public override void OnDeath( Container c ) { MeerMage.StopEffect( this, false ); if ( IsBonded ) { int sound = this.GetDeathSound(); if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); List<AggressorInfo> aggressors = this.Aggressors; for ( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = aggressors[i]; if ( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } List<AggressorInfo> aggressed = this.Aggressed; for ( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = aggressed[i]; if ( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } GiftOfLifeSpell.HandleDeath( this ); CheckStatTimers(); SetGhostDeletionTimer( true ); } else { if ( !Summoned && !m_NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; List<DamageStore> list = GetLootingRights( this.DamageEntries, this.HitsMax ); bool givenQuestKill = false; bool givenFactionKill = false; bool givenToTKill = false; for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = list[i]; if ( !ds.m_HasRight ) continue; Titles.AwardFame( ds.m_Mobile, totalFame, true ); Titles.AwardKarma( ds.m_Mobile, totalKarma, true ); OnKilledBy( ds.m_Mobile ); if ( !givenFactionKill ) { givenFactionKill = true; Faction.HandleDeath( this, ds.m_Mobile ); } if( !givenToTKill ) { givenToTKill = true; TreasuresOfTokuno.HandleKill( this, ds.m_Mobile ); } if ( givenQuestKill ) continue; PlayerMobile pm = ds.m_Mobile as PlayerMobile; if ( pm != null ) { QuestSystem qs = pm.Quest; if ( qs != null ) { qs.OnKill( this, c ); givenQuestKill = true; } #region Mondain's Legacy QuestHelper.CheckCreature( pm, this ); #endregion } } } base.OnDeath( c ); if ( DeleteCorpseOnDeath ) c.Delete(); } }
public override void OnDeath( Container c ) { if ( !Summoned && !Crafted ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; ArrayList toGive = new ArrayList(); //List<Aggressors> list = Aggressors; //List list = List<Aggressors>;//Aggressors; for ( int i = 0; i < /*Attacker.*/Aggressors.Count; ++i ) //for ( int i = 0; i < list.Count; ++i ) { //List<AggressorInfo> info = (AggressorInfo)list[i]; AggressorInfo info = (AggressorInfo)/*Attacker.*/Aggressors[i]; //List<AggressorInfo> info = (AggressorInfo)list[i];//controlMaster.Aggressors; if ( (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Attacker ) ) toGive.Add( info.Attacker ); } //list = Aggressed; //for ( int i = 0; i < list.Count; ++i ) for ( int i = 0; i < /*owner.*/Aggressors.Count; ++i ) { //AggressorInfo info = (AggressorInfo)list[i]; AggressorInfo info = (AggressorInfo)/*Defender.*/Aggressors[i]; if ( (DateTime.Now - info.LastCombatTime) < TimeSpan.FromSeconds( 30.0 ) && !toGive.Contains( info.Defender ) ) toGive.Add( info.Defender ); } for ( int i = 0; i < toGive.Count; ++i ) { Mobile m = (Mobile)toGive[i]; int karmaToGive = totalKarma; int fameToGive = totalFame; if ( m.Karma < 0 ) { if ( Karma > 0 && m.Karma <= -Karma ) karmaToGive = 0; } else if ( m.Karma > 0 ) { if ( Karma < 0 && m.Karma >= -Karma ) karmaToGive = 0; } if ( m.Fame > Fame ) fameToGive = 0; if ( (m.Karma + karmaToGive) > 10000 ) karmaToGive = 10000 - m.Karma; else if ( (m.Karma + karmaToGive) < -10000 ) karmaToGive = -10000 - m.Karma; if ( (m.Fame + fameToGive) > 10000 ) fameToGive = 10000 - m.Fame; else if ( (m.Fame + fameToGive) < 0 ) fameToGive = -m.Fame; m.Karma += karmaToGive; m.Fame += fameToGive; if ( fameToGive >= 40 ) m.SendLocalizedMessage( 1019054 ); // You have gained a lot of fame. else if ( fameToGive >= 25 ) m.SendLocalizedMessage( 1019053 ); // You have gained a good amount of fame. else if ( fameToGive >= 10 ) m.SendLocalizedMessage( 1019052 ); // You have gained some fame. else if ( fameToGive >= 1 ) m.SendLocalizedMessage( 1019051 ); // You have gained a little fame. else if ( fameToGive <= -40 ) m.SendLocalizedMessage( 1019058 ); // You have lost a lot of fame. else if ( fameToGive <= -25 ) m.SendLocalizedMessage( 1019057 ); // You have lost a good amount of fame. else if ( fameToGive <= -10 ) m.SendLocalizedMessage( 1019056 ); // You have lost some fame. else if ( fameToGive <= -1 ) m.SendLocalizedMessage( 1019055 ); // You have lost a little fame. if ( karmaToGive >= 40 ) m.SendLocalizedMessage( 1019062 ); // You have gained a lot of karma. else if ( karmaToGive >= 25 ) m.SendLocalizedMessage( 1019060 ); // You have gained some karma. else if ( karmaToGive >= 10 ) m.SendLocalizedMessage( 1019060 ); // You have gained some karma. else if ( karmaToGive >= 1 ) m.SendLocalizedMessage( 1019059 ); // You have gained a little karma. else if ( karmaToGive <= -40 ) m.SendLocalizedMessage( 1019066 ); // You have lost a lot of karma. else if ( karmaToGive <= -25 ) m.SendLocalizedMessage( 1019065 ); // You have lost a good amount of karma. else if ( karmaToGive <= -10 ) m.SendLocalizedMessage( 1019064 ); // You have lost some karma. else if ( karmaToGive <= -1 ) m.SendLocalizedMessage( 1019063 ); // You have lost a little karma. } } base.OnDeath( c ); if ( Crafted ) c.Delete(); }
public override void OnDeath(Container c) { Grandma2 s2 = new Grandma2(); s2.Map = this.Map; s2.Location = this.Location; base.OnDeath(c); c.Delete(); }
public override void OnDeath(Container c) { Talon4 t4 = new Talon4(); t4.Map = this.Map; t4.Location = this.Location; base.OnDeath(c); c.Delete(); }
//Pix 4/8/06 - Not used // public static ArrayList GetLootingRights( ArrayList damageEntries, int hitsMax ) // { // LogHelper Logger = new LogHelper("GetLootingRights.log", false); // ArrayList rights = new ArrayList(); // // Logger.Log(LogType.Text, String.Format("damageEntries.Count:{0}",damageEntries.Count)); // // for ( int i = damageEntries.Count - 1; i >= 0; --i ) // { // if ( i >= damageEntries.Count ) // continue; // // DamageEntry de = (DamageEntry)damageEntries[i]; // // string msg = string.Format( // "{0}: {1}, dam: {2}, resp: {3}, last: {4}, expired: {5}", // i, // de.Damager.Name, // de.DamageGiven, // de.Responsible, // de.LastDamage, // de.HasExpired // ); // Logger.Log( LogType.Text, msg ); // } // // for ( int i = damageEntries.Count - 1; i >= 0; --i ) // { // if ( i >= damageEntries.Count ) // continue; // // DamageEntry de = (DamageEntry)damageEntries[i]; // // if ( de.HasExpired ) // { // Logger.Log(LogType.Text, String.Format("de.HasExpired:{0}",i)); // damageEntries.RemoveAt( i ); // continue; // } // // int damage = de.DamageGiven; // // ArrayList respList = de.Responsible; // // if ( respList != null ) // { // Logger.Log(LogType.Text, String.Format("de.Responsible.Count:{0}",respList.Count)); // // for ( int j = 0; j < respList.Count; ++j ) // { // DamageEntry subEntry = (DamageEntry)respList[j]; // Mobile master = subEntry.Damager; // // if ( master == null || master.Deleted || !master.Player ) // { // Logger.Log(LogType.Text, String.Format("if ( master == null || master.Deleted || !master.Player )")); // continue; // } // // bool needNewSubEntry = true; // // for ( int k = 0; needNewSubEntry && k < rights.Count; ++k ) // { // DamageStore ds = (DamageStore)rights[k]; // // if ( ds.m_Mobile == master ) // { // ds.m_Damage += subEntry.DamageGiven; // needNewSubEntry = false; // } // } // // if ( needNewSubEntry ) // rights.Add( new DamageStore( master, subEntry.DamageGiven ) ); // // damage -= subEntry.DamageGiven; // } // } // // Mobile m = de.Damager; // // if ( m == null || m.Deleted || !m.Player ) // { // Logger.Log(LogType.Text, String.Format("if ( m == null || m.Deleted || !m.Player )")); // continue; // } // // if ( damage <= 0 ) // { // Logger.Log(LogType.Text, String.Format("if ( damage <= 0 )")); // continue; // } // // bool needNewEntry = true; // // for ( int j = 0; needNewEntry && j < rights.Count; ++j ) // { // DamageStore ds = (DamageStore)rights[j]; // // if ( ds.m_Mobile == m ) // { // ds.m_Damage += damage; // needNewEntry = false; // } // } // // if ( needNewEntry ) // rights.Add( new DamageStore( m, damage ) ); // } // // if ( rights.Count > 0 ) // { // if ( rights.Count > 1 ) // rights.Sort(); // // int topDamage = ((DamageStore)rights[0]).m_Damage; // int minDamage; // // if ( hitsMax >= 3000 ) // minDamage = topDamage / 16; // else if ( hitsMax >= 1000 ) // minDamage = topDamage / 8; // else if ( hitsMax >= 200 ) // minDamage = topDamage / 4; // else // minDamage = topDamage / 2; // // Logger.Log(LogType.Text, String.Format("topDamage:{0}",topDamage)); // Logger.Log(LogType.Text, String.Format("minDamage:{0}",minDamage)); // // for ( int i = 0; i < rights.Count; ++i ) // { // DamageStore ds = (DamageStore)rights[i]; // // ds.m_HasRight = ( ds.m_Damage >= minDamage ); // // Logger.Log(LogType.Text, String.Format("ds.m_HasRight = ( ds.m_Damage >= minDamage ):{0}",ds.m_HasRight)); // } // } // // // done logging // Logger.Finish(); // // return rights; // } public override void OnDeath( Container c ) { if ( IsBonded ) { int sound = this.GetDeathSound(); if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; //Bonded pet will take statloss until this time // initially 3.0 hours from death. m_StatLossTime = DateTime.Now + TimeSpan.FromHours(3.0); ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); ArrayList aggressors = this.Aggressors; for ( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = (AggressorInfo)aggressors[i]; if ( info.Attacker is BaseGuard ) c.Delete(); if ( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } ArrayList aggressed = this.Aggressed; for ( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = (AggressorInfo)aggressed[i]; if ( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } } else { if ( !Summoned && !m_NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; ArrayList list = GetLootingRights( this.DamageEntries ); bool givenQuestKill = false; for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = (DamageStore)list[i]; if ( !ds.m_HasRight ) continue; // Adam: distribute Fame/Karma Party p = Server.Engines.PartySystem.Party.Get( ds.m_Mobile ); if ( p != null && p.Leader != null ) { int partyFame = totalFame / p.Count; int partyKarma = totalKarma / p.Count; foreach ( PartyMemberInfo mi in p.Members ) { Mobile m = mi.Mobile; if ( m != null ) { Titles.AwardFame ( m, partyFame, true); Titles.AwardKarma ( m, partyKarma, true); } } } else { Titles.AwardFame( ds.m_Mobile, totalFame, true ); Titles.AwardKarma( ds.m_Mobile, totalKarma, true ); } if ( givenQuestKill ) continue; PlayerMobile pm = ds.m_Mobile as PlayerMobile; if ( pm != null ) { QuestSystem qs = pm.Quest; if ( qs != null ) { qs.OnKill( this, c ); givenQuestKill = true; } } } } //SMD: Oct. 2007: Added kin power points if (Engines.IOBSystem.KinSystemSettings.PointsEnabled && true == false)//plasma: no power points for now ! take this true==false back out later (or refactor this and put this code in IOBSytem with the other power point allocation code :< ). { if (this.IOBAlignment != IOBAlignment.None && this.ControlSlots >= 3) { try { //Award Kin Power Points. //Determine who gets the points: if (this.LastKiller is PlayerMobile) { PlayerMobile pmLK = LastKiller as PlayerMobile; if (pmLK != null && pmLK.IOBAlignment != this.IOBAlignment && pmLK.IOBAlignment != IOBAlignment.OutCast && pmLK.IOBAlignment != IOBAlignment.Healer ) { double awarded = pmLK.AwardKinPowerPoints(1.0); if (awarded > 0) { pmLK.SendMessage("You have received {0:0.00} power points.", awarded); } } } } catch (Exception kinppex) { LogHelper.LogException(kinppex, "Problem while awarding kin power points."); } } } base.OnDeath( c ); if ( DeleteCorpseOnDeath ) c.Delete(); #region [ On GuardKill ] //this little bit added by Old Salty if ( !this.Player ) { foreach( DamageEntry de in DamageEntries ) { if ( de.Damager is BaseGuard && c != null ) c.Delete(); } } #endregion } }
public override void OnDoubleClick(Mobile from) { // if not a player Mobile m_Mob = (Mobile)from; AccessLevel al_MobLevel = m_Mob.AccessLevel; Account a_Account = (Account)m_Mob.Account; AccessLevel al_AccLevel = a_Account.AccessLevel; if (al_AccLevel > AccessLevel.Player) { // if not already possessing a mobile if (!m_Possessing) { from.SendMessage("Who or What do you want to possess?"); from.Target = new InternalTarget(this); } // restore your self and unhide the previously possessed mobile else { // restore basics m_Possessing = false; from.Karma = m_Karma; from.Fame = m_Fame; from.Name = m_Name; from.Title = m_Title; from.Hue = m_Hue; from.BodyValue = m_BodyValue; from.Female = m_Female; from.Hidden = true; // Delete eveything you have equipped which is just a copy of what the NPC had ArrayList equipitems = new ArrayList(from.Items); foreach (Item item in equipitems) { if ((item.Layer != Layer.Bank) && (item.Layer != Layer.Backpack)) { item.Delete(); } } // get dressed and delete that white backpack for (int i = m_Stuff.Items.Count - 1; i >= 0; --i) { if (i >= m_Stuff.Items.Count) { continue; } from.EquipItem((Item)m_Stuff.Items[i]); } // do we really want to delete the backpack? m_Stuff.Delete(); // get your location, orient, enabale and show the mobile Point3D from_Location = new Point3D(from.Location.X, from.Location.Y, from.Location.Z); if (m_Possessed != null) { m_Possessed.Direction = from.Direction; m_Possessed.MoveToWorld(from_Location, from.Map); m_Possessed.Hidden = false; m_Possessed.CantWalk = false; } } } else // somehow a player got one of these which should never happen, just delete it and put a scare into them { from.SendMessage("You are trying to access a restricted item. The item has been removed and your account has been scheduled for deletion."); this.Delete(); } }
public override void OnDeath( Container c ) { if( this.VanishTime == DateTime.MinValue ) AwardXPnCP(); Lives--; if( Lives >= 0 ) { m_TimeOfDeath = DateTime.Now; BeginRess( m_DefaultRessTime, c ); } else this.IsBonded = false; if ( IsBonded && WaitForRess ) { int sound = this.GetDeathSound(); if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); List<AggressorInfo> aggressors = this.Aggressors; for ( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = aggressors[i]; if ( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } List<AggressorInfo> aggressed = this.Aggressed; for ( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = aggressed[i]; if ( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } CheckStatTimers(); } else { Mobile killer = this.FindMostRecentDamager( true ); if( killer != null ) { OnKilledBy( killer ); OnXMLEvent( XMLEventType.OnDeathInvokeOnMobile, killer ); } base.OnDeath( c ); if( DeleteCorpseOnDeath ) c.Delete(); else OnXMLEvent( XMLEventType.OnDeathInvokeOnItem, c ); OnXMLEvent( XMLEventType.OnDeath ); } }
public override void OnDeath( Container c ) { MeerMage.StopEffect( this, false ); if ( IsBonded ) { int sound = this.GetDeathSound(); if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); ArrayList aggressors = this.Aggressors; for ( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = (AggressorInfo)aggressors[i]; if ( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } ArrayList aggressed = this.Aggressed; for ( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = (AggressorInfo)aggressed[i]; if ( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } CheckStatTimers(); } else { if ( !Summoned && !m_NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; ArrayList list = GetLootingRights( this.DamageEntries, this.HitsMax ); bool givenQuestKill = false; bool givenFactionKill = false; for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = (DamageStore)list[i]; if ( !ds.m_HasRight ) continue; Titles.AwardFame( ds.m_Mobile, totalFame, true ); Titles.AwardKarma( ds.m_Mobile, totalKarma, true ); if ( m_Paragon ) if ( Paragon.CheckArtifactChance( ds.m_Mobile, this ) ) Paragon.GiveArtifactTo( ds.m_Mobile ); if ( !givenFactionKill ) { givenFactionKill = true; Faction.HandleDeath( this, ds.m_Mobile ); } if ( givenQuestKill ) continue; PlayerMobile pm = ds.m_Mobile as PlayerMobile; if ( pm != null ) { QuestSystem qs = pm.Quest; if ( qs != null ) { qs.OnKill( this, c ); givenQuestKill = true; } } } } base.OnDeath( c ); if ( DeleteCorpseOnDeath ) c.Delete(); } }
public override void OnDeath(Container c) { base.OnDeath(c); if (c != null) c.Delete(); }
public override void OnDeath( Container c ) { MeerMage.StopEffect( this, false ); if ( IsBonded ) { int sound = this.GetDeathSound(); if ( sound >= 0 ) Effects.PlaySound( this, this.Map, sound ); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); List<AggressorInfo> aggressors = this.Aggressors; for ( int i = 0; i < aggressors.Count; ++i ) { AggressorInfo info = aggressors[i]; if ( info.Attacker.Combatant == this ) info.Attacker.Combatant = null; } List<AggressorInfo> aggressed = this.Aggressed; for ( int i = 0; i < aggressed.Count; ++i ) { AggressorInfo info = aggressed[i]; if ( info.Defender.Combatant == this ) info.Defender.Combatant = null; } Mobile owner = this.ControlMaster; if ( owner == null || owner.Deleted || owner.Map != this.Map || !owner.InRange( this, 12 ) || !this.CanSee( owner ) || !this.InLOS( owner ) ) { if ( this.OwnerAbandonTime == DateTime.MinValue ) this.OwnerAbandonTime = DateTime.Now; } else { this.OwnerAbandonTime = DateTime.MinValue; } GiftOfLifeSpell.HandleDeath( this ); CheckStatTimers(); } else { if ( !Summoned && !m_NoKillAwards ) { int totalFame = Fame / 100; int totalKarma = -Karma / 100; if (Map == Map.Felucca) { totalFame += ((totalFame/10)*3); totalKarma += ((totalKarma/10)*3); } List<DamageStore> list = GetLootingRights( this.DamageEntries, this.HitsMax ); List<Mobile> titles = new List<Mobile>(); List<int> fame = new List<int>(); List<int> karma = new List<int>(); bool givenQuestKill = false; bool givenFactionKill = false; bool givenToTKill = false; for ( int i = 0; i < list.Count; ++i ) { DamageStore ds = list[i]; if ( !ds.m_HasRight ) continue; Party party = Engines.PartySystem.Party.Get( ds.m_Mobile ); if ( party != null ) { int divedFame = totalFame / party.Members.Count; int divedKarma = totalKarma / party.Members.Count; for ( int j = 0; j < party.Members.Count; ++j ) { PartyMemberInfo info = party.Members[ j ] as PartyMemberInfo; if ( info != null && info.Mobile != null ) { int index = titles.IndexOf( info.Mobile ); if ( index == -1 ) { titles.Add( info.Mobile ); fame.Add( divedFame ); karma.Add( divedKarma ); } else { fame[ index ] += divedFame; karma[ index ] += divedKarma; } } } } else { titles.Add( ds.m_Mobile ); fame.Add( totalFame ); karma.Add( totalKarma ); } OnKilledBy( ds.m_Mobile ); if ( !givenFactionKill ) { givenFactionKill = true; Faction.HandleDeath( this, ds.m_Mobile ); } Region region = ds.m_Mobile.Region; if( !givenToTKill && ( Map == Map.Tokuno || region.IsPartOf( "Yomotsu Mines" ) || region.IsPartOf( "Fan Dancer's Dojo" ) )) { givenToTKill = true; TreasuresOfTokuno.HandleKill( this, ds.m_Mobile ); } if ( givenQuestKill ) continue; PlayerMobile pm = ds.m_Mobile as PlayerMobile; if ( pm != null ) { QuestSystem qs = pm.Quest; if ( qs != null ) { qs.OnKill( this, c ); givenQuestKill = true; } } } for ( int i = 0; i < titles.Count; ++i ) { Titles.AwardFame( titles[ i ], fame[ i ], true ); Titles.AwardKarma( titles[ i ], karma[ i ], true ); } } base.OnDeath( c ); if ( DeleteCorpseOnDeath ) c.Delete(); } }
public override void OnDeath(Container c) { MeerMage.StopEffect(this, false); if (IsBonded) { int sound = GetDeathSound(); if (sound >= 0) Effects.PlaySound(this, Map, sound); Warmode = false; Poison = null; Combatant = null; Hits = 0; Stam = 0; Mana = 0; IsDeadPet = true; ControlTarget = ControlMaster; ControlOrder = OrderType.Follow; ProcessDeltaQueue(); SendIncomingPacket(); SendIncomingPacket(); List<AggressorInfo> aggressors = Aggressors; for (int i = 0; i < aggressors.Count; ++i) { AggressorInfo info = aggressors[i]; if (info.Attacker.Combatant == this) info.Attacker.Combatant = null; } List<AggressorInfo> aggressed = Aggressed; for (int i = 0; i < aggressed.Count; ++i) { AggressorInfo info = aggressed[i]; if (info.Defender.Combatant == this) info.Defender.Combatant = null; } Mobile owner = ControlMaster; if (owner == null || owner.Deleted || owner.Map != Map || !owner.InRange(this, 12) || !CanSee(owner) || !InLOS(owner)) { if (OwnerAbandonTime == DateTime.MinValue) OwnerAbandonTime = DateTime.Now; } else { OwnerAbandonTime = DateTime.MinValue; } GiftOfLifeSpell.HandleDeath(this); CheckStatTimers(); } else { //When creatures are killed by guards the kill should not be counted towards the player and corpse should be deleted to prevent abuse if (LastKiller is BaseGuard) { base.OnDeath(c); c.Delete(); return; } if (!Summoned && !m_NoKillAwards) { int totalFame = Fame / 300; int totalKarma = -Karma / 300; /* if (Map == Map.Felucca) { totalFame += ((totalFame / 10) * 3); totalKarma += ((totalKarma / 10) * 3); } */ List<DamageStore> list = GetLootingRights(DamageEntries, HitsMax); List<Mobile> titles = new List<Mobile>(); List<int> fame = new List<int>(); List<int> karma = new List<int>(); //Maka - KillInfo TrySaveKillInfo(c.Items); bool givenQuestKill = false; bool givenFactionKill = false; bool givenToTKill = false; for (int i = 0; i < list.Count; ++i) { DamageStore ds = list[i]; if (!ds.m_HasRight) continue; Party party = Engines.PartySystem.Party.Get(ds.m_Mobile); if (party != null) { int divedFame = totalFame / party.Members.Count; int divedKarma = totalKarma / party.Members.Count; for (int j = 0; j < party.Members.Count; ++j) { PartyMemberInfo info = party.Members[j] as PartyMemberInfo; if (info != null && info.Mobile != null) { int index = titles.IndexOf(info.Mobile); if (index == -1) { titles.Add(info.Mobile); fame.Add(divedFame); karma.Add(divedKarma); } else { fame[index] += divedFame; karma[index] += divedKarma; } } } } else { titles.Add(ds.m_Mobile); fame.Add(totalFame); karma.Add(totalKarma); } // modification to support XmlQuest Killtasks XmlQuest.RegisterKill(this, ds.m_Mobile); OnKilledBy(ds.m_Mobile); if (!givenFactionKill) { givenFactionKill = true; Faction.HandleDeath(this, ds.m_Mobile); } if (!givenToTKill && Map == Map.Tokuno) { givenToTKill = true; TreasuresOfTokuno.HandleKill(this, ds.m_Mobile); } if (givenQuestKill) continue; PlayerMobile pm = ds.m_Mobile as PlayerMobile; if (pm != null) { QuestSystem qs = pm.Quest; if (qs != null) { qs.OnKill(this, c); givenQuestKill = true; } } } for (int i = 0; i < titles.Count; ++i) { Titles.AwardFame(titles[i], fame[i], true); Titles.AwardKarma(titles[i], karma[i], true); } } base.OnDeath(c); if (IsInEvent && c is Corpse) c.EventItem = true; //So that players in events can loot the body if configured that way if (DeleteCorpseOnDeath) c.Delete(); } }