public override void OnHit( Mobile attacker, Mobile defender ) { base.OnHit( attacker, defender ); if ( !Core.AOS && Poison != null && PoisonCharges > 0 ) { --PoisonCharges; if ( Utility.RandomDouble() < PoisonChance && !defender.Poisoned ) { defender.ApplyPoison( attacker, Poison ); defender.SayTo( defender, true, "{0} has just poisoned you!", attacker.Name ); } } }
public static void TryPirateBlab(Mobile from, Mobile npc) { if (m_PirateBlabTable.ContainsKey(from) && m_PirateBlabTable[from] > DateTime.UtcNow || BountyQuestSpawner.Bounties.Count <= 0) return; //Make of list of bounties on their map List<Mobile> bounties = new List<Mobile>(); foreach (Mobile mob in BountyQuestSpawner.Bounties.Keys) { if (mob.Map == from.Map && mob is PirateCaptain && !bounties.Contains(mob)) bounties.Add(mob); } if (bounties.Count == 0) return; Mobile bounty = bounties[Utility.Random(bounties.Count)]; if (bounty != null) { PirateCaptain capt = (PirateCaptain)bounty; int xLong = 0, yLat = 0; int xMins = 0, yMins = 0; bool xEast = false, ySouth = false; Point3D loc = capt.Location; Map map = capt.Map; string locArgs; //string nameArgs; string combine; if (Sextant.Format(loc, map, ref xLong, ref yLat, ref xMins, ref yMins, ref xEast, ref ySouth)) locArgs = String.Format("{0}°{1}'{2},{3}°{4}'{5}", yLat, yMins, ySouth ? "S" : "N", xLong, xMins, xEast ? "E" : "W"); else locArgs = "?????"; //if (capt.PirateName > -1) // nameArgs = String.Format("#{0} #{1} #{2}", capt.Adjective, capt.Noun, capt.PirateName); //else // nameArgs = String.Format("#{0} #{1} {2}", capt.Adjective, capt.Noun, capt.Name); combine = String.Format("{0}\t{1}", capt.PirateName > -1 ? String.Format("#{0}", capt.PirateName) : capt.Name, locArgs); int cliloc = Utility.RandomMinMax(1149856, 1149865); npc.SayTo(from, cliloc, combine); m_PirateBlabTable[from] = DateTime.UtcNow + BlabDuration; } }
protected override void OnTarget( Mobile from, object targeted ) { if ( !m_Crystal.IsAccessibleTo( from ) ) return; if ( from.Map != m_Crystal.Map || !from.InRange( m_Crystal.GetWorldLocation(), 2 ) ) { //from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. int OldHue = from.SpeechHue; from.SpeechHue = 0; from.SayTo(from, true, "I can't reach that."); from.SpeechHue = OldHue; return; } if ( targeted == m_Crystal ) { if ( m_Crystal.Active ) { m_Crystal.Active = false; from.SendLocalizedMessage( 500672 ); // You turn the crystal off. } else { m_Crystal.Active = true; from.SendLocalizedMessage( 500673 ); // You turn the crystal on. } } else if ( targeted == from ) { if ( m_Crystal.Sender != null ) { m_Crystal.Sender = null; from.SendLocalizedMessage( 1010044 ); // You unlink the receiver crystal. } else { from.SendLocalizedMessage( 1010045 ); // That receiver crystal is not linked. } } else { Item targItem = targeted as Item; if ( targItem != null && targItem.VerifyMove( from ) ) { CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() ); if ( info != null ) { from.SendLocalizedMessage( 500677 ); // This crystal cannot be recharged. return; } } from.SendLocalizedMessage( 1010045 ); // That receiver crystal is not linked. } }
public override void OnDoubleClick( Mobile from ) { if ( !from.InRange( GetWorldLocation(), 2 ) ) { //from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. int OldHue = from.SpeechHue; from.SpeechHue = 0; from.SayTo(from, true, "I can't reach that."); from.SpeechHue = OldHue; return; } from.Target = new InternalTarget( this ); }
protected override void OnTarget( Mobile from, object targeted ) { if ( !m_Crystal.IsAccessibleTo( from ) ) return; if ( from.Map != m_Crystal.Map || !from.InRange( m_Crystal.GetWorldLocation(), 2 ) ) { //from.LocalOverheadMessage( MessageType.Regular, 0x3B2, 1019045 ); // I can't reach that. int OldHue = from.SpeechHue; from.SpeechHue = 0; from.SayTo(from, true, "I can't reach that."); from.SpeechHue = OldHue; return; } if ( targeted == m_Crystal ) { if ( m_Crystal.Active ) { m_Crystal.Active = false; //from.SendLocalizedMessage( 500672 ); // You turn the crystal off. from.SendAsciiMessage( "You turn the crystal off." ); } else { if ( m_Crystal.Charges > 0 ) { m_Crystal.Active = true; //from.SendLocalizedMessage( 500673 ); // You turn the crystal on. from.SendAsciiMessage( "You turn the crystal on." ); } else { //from.SendLocalizedMessage( 500676 ); // This crystal is out of charges. from.SendAsciiMessage( "This crystal is out of charges" ); } } } else if ( targeted is BroadcastCrystal ) { BroadcastCrystal receiver = (BroadcastCrystal) targeted; if ( m_Crystal.Receivers.Count >= 10 ) { //from.SendLocalizedMessage( 1010042 ); // This broadcast crystal is already linked to 10 receivers. from.SendAsciiMessage( "This broadcast crystal is already linked to 10 receivers" ); } /*else if ( receiver.Sender == m_Crystal ) { from.SendLocalizedMessage( 500674 ); // This crystal is already linked with that crystal. }*/ else if ( receiver.Sender != null ) { receiver.Sender = null; //from.SendLocalizedMessage( 1010044 ); // You unlink the receiver crystal. from.SendAsciiMessage( "That crystal has been unlinked to this crystal." ); } else { receiver.Sender = m_Crystal; //from.SendLocalizedMessage( 500675 ); // That crystal has been linked to this crystal. from.SendAsciiMessage( "That crystal has been linked to this crystal." ); } } else if ( targeted == from ) { foreach (BroadcastCrystal receiver in new ArrayList(m_Crystal.Receivers)) { receiver.Sender = null; } //from.SendLocalizedMessage( 1010046 ); // You unlink the broadcast crystal from all of its receivers. from.SendAsciiMessage( "You unlink all of the crystals." ); } else { Item targItem = targeted as Item; if ( targItem != null && targItem.VerifyMove( from ) ) { CrystalRechargeInfo info = CrystalRechargeInfo.Get( targItem.GetType() ); if ( info != null ) { if ( m_Crystal.Charges >= MaxCharges ) { //from.SendLocalizedMessage( 500678 ); // This crystal is already fully charged. from.SendAsciiMessage( "This crystal is already fully charged." ); } else { targItem.Consume(); if ( m_Crystal.Charges + info.Amount >= MaxCharges ) { m_Crystal.Charges = MaxCharges; //from.SendLocalizedMessage( 500679 ); // You completely recharge the crystal. from.SendAsciiMessage( "You completely recharge the crystal." ); } else { m_Crystal.Charges += info.Amount; //from.SendLocalizedMessage( 500680 ); // You recharge the crystal. from.SendAsciiMessage( "You recharge the crystal." ); } } return; } } //from.SendLocalizedMessage( 500681 ); // You cannot use this crystal on that. from.SendAsciiMessage( "You cannot use this crystal on that." ); } }
private void GiveHint(Mobile player, Mobile vendor) { vendor.SayTo(player, "A good place to hunt these days is {0}.", WorldLocationInfo.Locations[0][m_BonusIndex].RegionName); m_NextHint = DateTime.UtcNow + TimeSpan.FromMinutes(Utility.RandomMinMax(30, 60)); }
public override void OnResponse( NetState state, RelayInfo info ) { Mobile from = state.Mobile; BaseCreature bc1 = (BaseCreature)m_Pet1; BaseCreature bc2 = (BaseCreature)m_Pet2; Mobile cm1 = bc1.ControlMaster; Mobile cm2 = bc2.ControlMaster; if ( from == null ) return; //Baby Stat Table if ( info.ButtonID == 1 ) { from.CloseGump( typeof( BreedingAcceptGump ) ); //from.CloseGump( typeof( BabyStatTableGump ) ); from.SendGump( new BreedingAcceptGump( m_Pet1, m_Pet2 ) ); //from.SendGump( new BabyStatTableGump( m_Pet1, m_Pet2 ) ); } //Accept if ( info.ButtonID == 2 ) { Mobile breeder = new Mobile(); Mobile owner = new Mobile(); int ai = 0; if ( bc1.AI == AIType.AI_Mage && bc2.AI == AIType.AI_Mage ) ai = 1; if ( bc1.AI == AIType.AI_Melee && bc2.AI == AIType.AI_Melee ) ai = 2; int xstr = bc1.RawStr + bc2.RawStr; int xdex = bc1.RawDex + bc2.RawDex; int xint = bc1.RawInt + bc2.RawInt; int xhits = bc1.HitsMax + bc2.HitsMax; int xstam = bc1.StamMax + bc2.StamMax; int xmana = bc1.ManaMax + bc2.ManaMax; int xphys = bc1.PhysicalResistance + bc2.PhysicalResistance; int xfire = bc1.FireResistance + bc2.FireResistance; int xcold = bc1.ColdResistance + bc2.ColdResistance; int xnrgy = bc1.EnergyResistance + bc2.EnergyResistance; int xpois = bc1.PoisonResistance + bc2.PoisonResistance; int xdmin = bc1.DamageMin + bc2.DamageMin; int xdmax = bc1.DamageMax + bc2.DamageMax; int xmlev = bc1.Level + bc2.Level; int newStr = xstr / 2; int newDex = xdex / 2; int newInt = xint / 2; int newHits = xhits / 2; int newStam = xstam / 2; int newMana = xmana / 2; int newPhys = xphys / 2; int newFire = xfire / 2; int newCold = xcold / 2; int newNrgy = xnrgy / 2; int newPois = xpois / 2; int newDmin = xdmin / 2; int newDmax = xdmax / 2; int newMlev = xmlev / 2; int babyStr = newStr + Utility.RandomMinMax( 0, 1 ); int babyDex = newDex + Utility.RandomMinMax( 0, 1 ); int babyInt = newInt + Utility.RandomMinMax( 0, 1 ); int babyHits = newHits + Utility.RandomMinMax( 0, 2 ); int babyStam = newStam + Utility.RandomMinMax( 0, 2 ); int babyMana = newMana + Utility.RandomMinMax( 0, 2 ); int babyPhys = newPhys + Utility.RandomMinMax( 0, 2 ); int babyFire = newFire + Utility.RandomMinMax( 0, 2 ); int babyCold = newCold + Utility.RandomMinMax( 0, 2 ); int babyNrgy = newNrgy + Utility.RandomMinMax( 0, 2 ); int babyPois = newPois + Utility.RandomMinMax( 0, 2 ); int babyDmin = newDmin; int babyDmax = newDmax; int babyMlev = newMlev + Utility.RandomMinMax( 1, 3 ); int stats = babyStr + babyDex + babyInt + babyHits + babyStam + babyMana + babyPhys + babyFire + babyCold + babyNrgy + babyPois + babyDmin + babyDmax + babyMlev; int newPrice = stats * 3; int babyPrice = newPrice; int chance = stats; if ( chance <= 1500 ) chance = 1500; if ( babyStr >= FSATS.NormalSTR ) babyStr = FSATS.NormalSTR; if ( babyDex >= FSATS.NormalDEX ) babyDex = FSATS.NormalDEX; if ( babyInt >= FSATS.NormalINT ) babyInt = FSATS.NormalINT; if ( babyPhys >= FSATS.NormalPhys ) babyPhys = FSATS.NormalPhys; if ( babyFire >= FSATS.NormalFire ) babyFire = FSATS.NormalFire; if ( babyCold >= FSATS.NormalCold ) babyCold = FSATS.NormalCold; if ( babyNrgy >= FSATS.NormalEnergy ) babyNrgy = FSATS.NormalEnergy; if ( babyPois >= FSATS.NormalPoison ) babyPois = FSATS.NormalPoison; if ( babyDmin >= FSATS.NormalMinDam ) babyDmin = FSATS.NormalMinDam; if ( babyDmax >= FSATS.NormalMaxDam ) babyDmax = FSATS.NormalMaxDam; if ( babyMlev >= 60 ) babyMlev = 60; foreach ( Mobile m in from.GetMobilesInRange( 5 ) ) { if ( m is AnimalBreeder ) breeder = m; if ( m == cm1 ) owner = m; } if ( breeder == null ) { from.SendMessage( "You must be near an animal breeder in order to breed your pet." ); if ( cm1 != null ) cm1.SendMessage( "The owner of the other pet is too far away from the animal breeder." ); } else if ( owner == null ) { from.SendMessage( "The owner of the other pet is not near by." ); if ( cm1 != null ) cm1.SendMessage( "You are to far away from the other pet owner." ); } else if ( Utility.Random( chance ) < 1500 ) { if ( cm1 != null ) //Generate Claim Ticket One { PetClaimTicket pct = new PetClaimTicket(); pct.AI = ai; pct.Owner = cm1; pct.Pet = m_Pet1; pct.Str = babyStr; pct.Dex = babyDex; pct.Int = babyInt; pct.Hits = babyHits; pct.Stam = babyStam; pct.Mana = babyMana; pct.Phys = babyPhys; pct.Fire = babyFire; pct.Cold = babyCold; pct.Nrgy = babyNrgy; pct.Pois = babyPois; pct.Dmin = babyDmin; pct.Dmax = babyDmax; pct.Mlev = babyMlev; pct.Gen = bc1.Generation; pct.Price = babyPrice; cm1.AddToBackpack( pct ); breeder.SayTo( cm1, "Ill hold onto your pet for you while its mating." ); breeder.SayTo( cm1, "Return here in three days and show me the claim ticket I gave to you." ); cm1.SendMessage( "They have accepted your offer." ); bc1.ControlTarget = null; bc1.ControlOrder = OrderType.Stay; bc1.Internalize(); bc1.SetControlMaster( null ); } if ( cm2 != null ) //Generate Claim Ticket One { PetClaimTicket pct = new PetClaimTicket(); pct.AI = ai; pct.Owner = cm2; pct.Pet = m_Pet2; pct.Str = babyStr; pct.Dex = babyDex; pct.Int = babyInt; pct.Hits = babyHits; pct.Stam = babyStam; pct.Mana = babyMana; pct.Phys = babyPhys; pct.Fire = babyFire; pct.Cold = babyCold; pct.Nrgy = babyNrgy; pct.Pois = babyPois; pct.Dmin = babyDmin; pct.Dmax = babyDmax; pct.Mlev = babyMlev; pct.Gen = bc2.Generation; pct.Price = babyPrice; cm2.AddToBackpack( pct ); breeder.SayTo( cm2, "Ill hold onto your pet for you while its mating." ); breeder.SayTo( cm2, "Return here in three days and the show me that claim ticket i gave to you." ); cm2.SendMessage( "You accept their offer." ); bc2.ControlTarget = null; bc2.ControlOrder = OrderType.Stay; bc2.Internalize(); bc2.SetControlMaster( null ); } if ( bc1 != null || bc2 != null ) { bc1.MatingDelay = DateTime.Now + TimeSpan.FromHours( 144.0 ); bc2.MatingDelay = DateTime.Now + TimeSpan.FromHours( 144.0 ); } } else { if ( cm1 != null && cm2 != null ) { cm1.SendMessage( "Breeding Failed: It is hard to successfully mate two strong pets together, You will have to wait 6 hours to try again." ); cm2.SendMessage( "Breeding Failed: It is hard to successfully mate two strong pets together, You will have to wait 6 hours to try again." ); bc1.MatingDelay = DateTime.Now + TimeSpan.FromHours( 6.0 ); bc2.MatingDelay = DateTime.Now + TimeSpan.FromHours( 6.0 ); } } } //Decline if ( info.ButtonID == 3 ) { from.SendMessage( "You have declined their offer." ); if ( cm1 != null ) cm1.SendMessage( "They have declined your offer" ); } }