public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; switch (info.ButtonID) { case 0: { from.CloseGump(typeof(RunicGump)); break; } case 1: { Item item = new RunicHammer(CraftResource.DullCopper, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 2: { Item item = new RunicHammer(CraftResource.ShadowIron, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 3: { Item item = new RunicHammer(CraftResource.Copper, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 4: { Item item = new RunicHammer(CraftResource.Bronze, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 5: { Item item = new RunicHammer(CraftResource.Gold, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 6: { Item item = new RunicHammer(CraftResource.Agapite, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 7: { Item item = new RunicHammer(CraftResource.Verite, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 8: { Item item = new RunicHammer(CraftResource.Valorite, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 9: { Item item = new RunicSewingKit(CraftResource.SpinedLeather, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 10: { Item item = new RunicSewingKit(CraftResource.HornedLeather, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 11: { Item item = new RunicSewingKit(CraftResource.BarbedLeather, 100); item.LootType = LootType.Blessed; from.AddToBackpack(item); break; } case 12: { Item item = new RunicBag(); from.AddToBackpack(item); break; } } }
// end public static void HandleDeath( Mobile victim, Mobile killer ) { if ((victim != null && victim.Region is CustomRegion && ((CustomRegion)victim.Region).NoFactionEffects) || (killer != null && killer.Region is CustomRegion && ((CustomRegion)killer.Region).NoFactionEffects)) return; if ( killer == null ) killer = victim.FindMostRecentDamager( true ); PlayerState victimState = PlayerState.Find( victim ); //to give statloss from guards if ( victimState != null && killer is BaseFactionGuard && ((BaseFactionGuard)killer).Faction != victimState.Faction ) ApplySkillLoss( victim ); PlayerState killerState = PlayerState.Find( killer ); Container pack = victim.Backpack; if ( pack != null ) { Container killerPack = ( killer == null ? null : killer.Backpack ); Item[] sigils = pack.FindItemsByType( typeof( Sigil ) ); for ( int i = 0; i < sigils.Length; ++i ) { Sigil sigil = (Sigil)sigils[i]; if ( killerState != null && killerPack != null ) { if ( Sigil.ExistsOn( killer ) ) { sigil.ReturnHome(); killer.SendLocalizedMessage( 1010258 ); // The sigil has gone back to its home location because you already have a sigil. } else if ( !killerPack.TryDropItem( killer, sigil, false ) ) { sigil.ReturnHome(); killer.SendLocalizedMessage( 1010259 ); // The sigil has gone home because your backpack is full. } } else { sigil.ReturnHome(); } } } if ( killerState == null ) return; if ( victim is BaseCreature ) { BaseCreature bc = (BaseCreature)victim; Faction victimFaction = bc.FactionAllegiance; bool bcRegionIsNoFactions = (bc.Region is CustomRegion && ((CustomRegion)bc.Region).NoFactionEffects); if ( Faction.IsFactionMap(bc.Map) && victimFaction != null && killerState.Faction != victimFaction && !bcRegionIsNoFactions) { int silver = killerState.Faction.AwardSilver( killer, bc.FactionSilverWorth ); if ( silver > 0 ) killer.SendLocalizedMessage( 1042748, silver.ToString( "N0" ) ); // Thou hast earned ~1_AMOUNT~ silver for vanquishing the vile creature. } return; } //PlayerState victimState = PlayerState.Find( victim ); if ( victimState == null ) return; // MODIFICATIONS FOR Capture the Flag / Double Dom games Server.Items.CTFTeam ft = Server.Items.CTFGame.FindTeamFor( killer ); if ( ft != null ) { Server.Items.CTFTeam tt = Server.Items.CTFGame.FindTeamFor( victim ); if ( tt != null && ft.Game == tt.Game ) return; } // END // MODIFICATIONS TO award correct player for faction kill ( last damager ) TimeSpan lastTime = TimeSpan.MaxValue; for ( int i = 0; i < victim.Aggressors.Count; ++i ) { AggressorInfo info = (AggressorInfo)victim.Aggressors[i]; if ( info.Attacker != null && info.Attacker is PlayerMobile && info.Attacker.Alive && (DateTime.Now - info.LastCombatTime) < lastTime && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromMinutes( 2.0 ) ) { PlayerMobile tempkiller = info.Attacker as PlayerMobile; PlayerState tempkillerState = PlayerState.Find( tempkiller ); if ( tempkillerState != null && tempkillerState.Faction != victimState.Faction ) { killer = tempkiller; killerState = tempkillerState; lastTime = (DateTime.Now - info.LastCombatTime); } } } for ( int i = 0; i < victim.Aggressed.Count; ++i ) { AggressorInfo info = (AggressorInfo)victim.Aggressed[i]; if ( info.Defender != null && info.Defender is PlayerMobile && info.Defender.Alive && (DateTime.Now - info.LastCombatTime) < lastTime && (DateTime.Now - info.LastCombatTime) < TimeSpan.FromMinutes( 2.0 ) ) { PlayerMobile tempkiller = info.Defender as PlayerMobile; PlayerState tempkillerState = PlayerState.Find( tempkiller ); if ( tempkillerState != null && tempkillerState.Faction != victimState.Faction ) { killer = tempkiller; killerState = tempkillerState; lastTime = (DateTime.Now - info.LastCombatTime); } } } // END if ( victim == null || killer == null || victimState == null || killerState == null ) return; if ( killer == victim || killerState.Faction != victimState.Faction ) ApplySkillLoss( victim ); if ( killerState.Faction != victimState.Faction ) { if ( victimState.KillPoints <= -6 ) { killer.SendLocalizedMessage( 501693 ); // This victim is not worth enough to get kill points from. } else { int award = Math.Max( victimState.KillPoints / 10, 1 ); if ( award > 40 ) award = 40; if ( victimState.CanGiveSilverTo( killer ) ) { if ( victimState.KillPoints > 0 ) { int silver = 0; silver = killerState.Faction.AwardSilver( killer, award * 40 ); if ( silver > 0 ) killer.SendLocalizedMessage( 1042736, String.Format( "{0:N0} silver\t{1}", silver, victim.Name ) ); // You have earned ~1_SILVER_AMOUNT~ pieces for vanquishing ~2_PLAYER_NAME~! } victimState.KillPoints -= award; killerState.KillPoints += award; int offset = ( award != 1 ? 0 : 2 ); // for pluralization string args = String.Format( "{0}\t{1}\t{2}", award, victim.Name, killer.Name ); killer.SendLocalizedMessage( 1042737 + offset, args ); // Thou hast been honored with ~1_KILL_POINTS~ kill point(s) for vanquishing ~2_DEAD_PLAYER~! victim.SendLocalizedMessage( 1042738 + offset, args ); // Thou has lost ~1_KILL_POINTS~ kill point(s) to ~3_ATTACKER_NAME~ for being vanquished! victimState.OnGivenSilverTo( killer ); killerState.LastKill = DateTime.Now; // jakob, added this to hand out rares double bonusChance = killerState.Faction.OwnedTowns * RareChancePerOwnedTown; if ( bonusChance > Utility.RandomDouble() ) { Type rareType = FactionRares.Rares[Utility.Random(FactionRares.Rares.Length)]; Item toGive = null; if ( rareType == typeof(RunicHammer) ) // special case for runic hammer { CraftResource resource = (CraftResource)(Utility.Random(9) + 1); int uses = Utility.Random( 1, 5 ); toGive = new RunicHammer( resource, uses ); } else { try { toGive = (Item)Activator.CreateInstance( rareType ); } catch(Exception e) { Console.WriteLine( "Error when rewarding faction member: {0}", e.ToString() ); } } if ( toGive != null ) { killer.AddToBackpack( toGive ); killer.SendMessage( "You have been given something special." ); } } // end } else { killer.SendLocalizedMessage( 1042231 ); // You have recently defeated this enemy and thus their death brings you no honor. } } } }
public override void OnDeath(Container c) { List<DamageStore> rights = BaseCreature.GetLootingRights(this.DamageEntries, this.HitsMax); List<Mobile> toGive = new List<Mobile>(); for (int i = rights.Count - 1; i >= 0; --i) { DamageStore ds = rights[i]; if (ds.m_HasRight) toGive.Add(ds.m_Mobile); } int chance = Utility.Random(100); //World.Broadcast(0x35, true, "{0}is the roll", chance); if (toGive.Count > 0) { Mobile rewardmob = toGive[Utility.Random(toGive.Count)]; Mobile weapmob = toGive[Utility.Random(toGive.Count)]; if (rewardmob is PlayerMobile) { Mobile m = (Mobile)rewardmob; } if (chance < 3) { RunicHammer hammer = new RunicHammer(CraftResource.Valorite, Utility.Random(5) + 8); hammer.LootType = LootType.Cursed; rewardmob.AddToBackpack(hammer); World.Broadcast(0x35, true, "{0} was rewarded with runic hammer", rewardmob.Name); } else if (chance < 5) { RunicSewingKit kit = new RunicSewingKit(CraftResource.BarbedLeather, Utility.Random(5) + 8); kit.LootType = LootType.Cursed; rewardmob.AddToBackpack(kit); World.Broadcast(0x35, true, "{0} was rewarded with runic sewing kit", rewardmob.Name); } else if (chance < 25) { rewardmob.AddToBackpack(new CopperBar(Utility.Random(2) + 2)); rewardmob.SendMessage("You have been rewarded with copper bars"); } } else { if (chance < 40) c.DropItem(new CopperBar(Utility.Random(2) + 1)); } if (!Summoned && !NoKillAwards && DemonKnight.CheckArtifactChance(this)) DemonKnight.DistributeArtifact(this); base.OnDeath(c); }
public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; switch( info.ButtonID ) { case 0: { from.CloseGump( typeof( RunicGump ) ); break; } case 1: { Item item = new RunicHammer( CraftResource.DullCopper, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 2: { Item item = new RunicHammer( CraftResource.ShadowIron, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 3: { Item item = new RunicHammer( CraftResource.Copper, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 4: { Item item = new RunicHammer( CraftResource.Bronze, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 5: { Item item = new RunicHammer( CraftResource.Gold, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 6: { Item item = new RunicHammer( CraftResource.Agapite, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 7: { Item item = new RunicHammer( CraftResource.Verite, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 8: { Item item = new RunicHammer( CraftResource.Valorite, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 9: { Item item = new RunicSewingKit( CraftResource.SpinedLeather, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 10: { Item item = new RunicSewingKit( CraftResource.HornedLeather, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 11: { Item item = new RunicSewingKit( CraftResource.BarbedLeather, 100 ); item.LootType = LootType.Blessed; from.AddToBackpack( item ); break; } case 12: { Item item = new RunicBag(); from.AddToBackpack( item ); break; } } }