public override bool OnMoveOver(Mobile m) { if (m.BodyValue == 0x190 || m.BodyValue == 0x191 || m.BodyValue == 0x25D || m.BodyValue == 0x25E) { if (m.BodyMod == 0) { m.SendMessage("You are Now Elven"); if (m.Female == true) m.BodyMod = 606; else m.BodyMod = 605; m.HueMod = 491; m.Title = "The Elf"; m.AddToBackpack(new ElvenShiftTalisman()); m.Location = new Point3D(m.X + 2, m.Y + 2, m.Z); World.Broadcast(0x35, true, "{0} joins the Elven community.", m.Name); m.PlaySound(535); Effects.SendLocationParticles(EffectItem.Create(m.Location, m.Map, EffectItem.DefaultDuration), 0x376A, 1, 29, 0x47D, 2, 9962, 0); Effects.SendLocationParticles(EffectItem.Create(new Point3D(m.X + 2, m.Y + 2, m.Z), m.Map, EffectItem.DefaultDuration), 0x37C4, 1, 29, 0x47D, 2, 9502, 0); } m.SendMessage("Your race has already been choosen."); } return false; }
public override void OnResponse( Mobile from, string text ) { if ( m_Item == null || m_Item.Deleted || !m_Item.IsChildOf( from.Backpack ) ) from.SendLocalizedMessage( 1042001 ); else { text = text.Trim(); if ( text == from.RawName ) from.SendMessage( "Please choose a unique and appropriate name." ); else { NameResultMessage result = NameVerification.ValidatePlayerName( text, 2, 16, true, false, true, 1, NameVerification.SpaceDashPeriodQuote ); if ( result == NameResultMessage.Allowed ) { from.Name = text; m_Item.Delete(); } else { switch ( result ) { case NameResultMessage.InvalidCharacter: from.SendMessage( "The chosen name has invalid characters." ); break; case NameResultMessage.TooFewCharacters: case NameResultMessage.TooManyCharacters: from.SendMessage( "Names must contain 2-16 alphabetic characters." ); break; case NameResultMessage.AlreadyExists: case NameResultMessage.NotAllowed: from.SendMessage( "This name is not available or not allowed." ); break; } } } } }
public override void OnDoubleClick(Mobile from) { Container backpack = from.Backpack; ShadowIronIngot item1 = (ShadowIronIngot)backpack.FindItemByType(typeof(ShadowIronIngot)); if (item1 != null) { BaseIngot m_Ore1 = item1 as BaseIngot; int toConsume = m_Ore1.Amount; if ((m_Ore1.Amount > 499) && (m_Ore1.Amount < 501)) { m_Ore1.Delete(); from.SendMessage("You've successfully converted the Metal."); from.AddToBackpack(new AgapiteIngot(500)); this.Delete(); } else if ((m_Ore1.Amount < 500) || (m_Ore1.Amount > 500)) { from.SendMessage("You can only convert 500 ShadowIron Ingots at a time."); } } else { from.SendMessage("There isn't ShadowIron Ingots in your Backpack."); } }
protected override void OnTarget( Mobile from, object target ) { if ( target is BaseCreature ) { BaseCreature t = ( BaseCreature ) target; if ( t.IsParagon == true ) { from.SendMessage( "That pet is already a paragon!" ); } else if ( t.ControlMaster != from ) { from.SendMessage( "That is not your pet!" ); } else { t.IsParagon = !t.IsParagon; from.SendMessage( "Your pet is now a paragon!" ); m_Deed.Delete(); // Delete the deed } } else { from.SendMessage( "That is not a valid traget." ); } }
public override void OnDoubleClick( Mobile from ) { if ( !( IsChildOf( from.Backpack ) ) ) from.SendMessage( "That has to be in your pack to be able to use it" ); else if ( from.Mounted ) from.SendMessage( "You can not use this while riding" ); else if ( bodyadjust != from.BodyMod && from.BodyMod != 0 ) from.SendMessage( "You can not use this while all ready morphed" ); else { if ( bodyadjust == 0 && (from.BodyValue == 0x190 || from.BodyValue == 0x191 || from.BodyValue == 605 || from.BodyValue == 606 )) { from.BodyMod = 157; bodyadjust = from.BodyMod; from.PlaySound( 1105 ); Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 ); } else if(bodyadjust == from.BodyMod) { from.BodyMod = 0; bodyadjust = from.BodyMod; from.PlaySound( 1105 ); Effects.SendLocationParticles( EffectItem.Create( from.Location, from.Map, EffectItem.DefaultDuration ), 0x376A, 1, 29, 0x47D, 2, 9962, 0 ); Effects.SendLocationParticles( EffectItem.Create( new Point3D( from.X, from.Y, from.Z - 7 ), from.Map, EffectItem.DefaultDuration ), 0x37C4, 1, 29, 0x47D, 2, 9502, 0 ); this.Delete(); } else bodyadjust = 0; } }
protected override void OnTarget( Mobile from, object targeted ) { if(from == null || targeted == null) return; string name = String.Empty; string typename = targeted.GetType().Name; string article = "a"; if (typename != null && typename.Length > 0) { if ("aeiouy".IndexOf(typename.ToLower()[0]) >= 0) { article = "an"; } } if(targeted is Item) { name = ((Item)targeted).Name; } else if(targeted is Mobile) { name = ((Mobile)targeted).Name; } if (name != String.Empty && name != null) { from.SendMessage("That is {0} {1} named '{2}'", article, typename, name); } else { from.SendMessage("That is {0} {1} with no name", article, typename); } }
public override void OnDoubleClick(Mobile from) { if ( from == null || !from.Alive ) return; // lumbervalue = 100; will give 100% sucsess in picking lumberValue = from.Skills[SkillName.Lumberjacking].Value / 5; if ( DateTime.Now > lastpicked.AddSeconds(3) ) // 3 seconds between picking { lastpicked = DateTime.Now; if ( from.InRange( this.GetWorldLocation(), 2 ) ) { if ( lumberValue > Utility.Random( 100 ) ) { from.Direction = from.GetDirectionTo( this ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow from.SendMessage(AgriTxt.PullRoot); this.Delete(); from.AddToBackpack( new NightshadeUprooted() ); } else from.SendMessage(AgriTxt.HardPull); } else { from.SendMessage(AgriTxt.HardPull); } } }
public void Carve( Mobile from, Item item ) { Effects.PlaySound( GetWorldLocation(), Map, 0x48F ); Effects.SendLocationEffect( GetWorldLocation(), Map, 0x3728, 10, 10, 0, 0 ); if ( 0.3 > Utility.RandomDouble() ) { if ( ItemID == 0xF7E ) from.SendMessage( "You destroy the bone." ); else from.SendMessage( "You destroy the bone pile." ); Gold gold = new Gold( 25, 100 ); gold.MoveToWorld( GetWorldLocation(), Map ); Delete(); m_Timer.Stop(); } else { if ( ItemID == 0xF7E ) from.SendMessage( "You damage the bone." ); else from.SendMessage( "You damage the bone pile." ); } }
public override bool TryDropItem( Mobile from, Item dropped, bool sendFullMessage ) { if ( m_Participant == null || !m_Participant.Contains( from ) ) { if ( sendFullMessage ) from.SendMessage( "You are not allowed to place items here." ); return false; } if ( dropped is Container || dropped.Stackable ) { if ( sendFullMessage ) from.SendMessage( "That item cannot be used as stakes." ); return false; } if ( !base.TryDropItem( from, dropped, sendFullMessage ) ) return false; if ( from != null ) m_Owners[dropped] = from; return true; }
public override bool OnMoveInto(Mobile m, Direction d, Point3D newLocation, Point3D oldLocation) { if (m.Player && Factions.Sigil.ExistsOn(m)) { m.SendMessage(0x22, "You are holding a sigil and cannot enter this zone."); return false; } PlayerMobile pm = m as PlayerMobile; if (pm == null && m is BaseCreature) { BaseCreature bc = (BaseCreature)m; if (bc.Summoned) pm = bc.SummonMaster as PlayerMobile; } if (pm != null && pm.DuelContext != null && pm.DuelContext.StartedBeginCountdown) return true; if (DuelContext.CheckCombat(m)) { m.SendMessage(0x22, "You have recently been in combat and cannot enter this zone."); return false; } return base.OnMoveInto(m, d, newLocation, oldLocation); }
protected override void OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature { if (_mDeed.Deleted || _mDeed.RootParent != from) return; BaseBoat boat; var boatcomponent = target as BoatComponent; if (boatcomponent != null) boat = boatcomponent.Boat; else boat = target as BaseBoat; if (boat == null) { from.SendMessage(54, "This deed only works on boats! Please target either the boats wheel or the tillerman to dye the boat."); return; } if (boat.Owner != from) { from.SendMessage(54, "Only the owner of this boat may dye it."); } else { foreach (var component in boat.BoatComponents) { component.Hue = _mDeed.DyeableHue; } boat.Hue = _mDeed.DyeableHue; from.SendMessage(54, "You have successfully dyed your boat."); _mDeed.Consume(); } }
protected override void OnTarget(Mobile from, object target) { if (target is BaseWeapon || target is BaseArmor || target is BaseClothing || target is BaseJewel) { Item item = (Item)target; XmlLevelItem a = (XmlLevelItem)XmlAttach.FindAttachment(item, typeof(XmlLevelItem)); if (a != null) { from.SendMessage("That already is levelable!"); return; } else { if (item.RootParent != from) // Make sure its in their pack or they are wearing it { from.SendMessage("You cannot make that levelable there!"); } else { // mod to attach the XmlPoints attachment automatically to new chars XmlAttach.AttachTo(item, new XmlLevelItem()); from.SendMessage("You magically make the item levelable..."); this.m_Deed.Delete(); } } } else { from.SendMessage("You cannot make that levelable"); } }
public override void OnDoubleClick(Mobile from) { if ( from == null || !from.Alive ) return; // lumbervalue = 100; will give 100% sucsess in picking mageValue = from.Skills[SkillName.Magery].Value + 20; if ( DateTime.Now > lastpicked.AddSeconds(1) ) // 3 seconds between picking changed to 1 sec { lastpicked = DateTime.Now; if ( from.InRange( this.GetWorldLocation(), 1 ) ) { if ( mageValue > Utility.Random( 100 ) ) { from.Direction = from.GetDirectionTo( this ); from.Animate( 32, 5, 1, true, false, 0 ); // Bow from.SendMessage("You pull the plant up by the root."); this.Delete(); from.AddToBackpack( new MandrakeUprooted() ); } else from.SendMessage("The plant is hard to pull up."); } else { from.SendMessage( "You are too far away to harvest anything." ); } } }
protected override void OnTarget(Mobile from, object obj) { HouseFoundation house; DesignInsertResult result = ProcessInsert(obj as Item, this.m_StaticsOnly, out house); switch ( result ) { case DesignInsertResult.Valid: { if (this.m_Foundations.Count == 0) from.SendMessage("The item has been inserted into the house design. Press ESC when you are finished."); else from.SendMessage("The item has been inserted into the house design."); if (!this.m_Foundations.Contains(house)) this.m_Foundations.Add(house); break; } case DesignInsertResult.InvalidItem: { from.SendMessage("That cannot be inserted. Try again."); break; } case DesignInsertResult.NotInHouse: case DesignInsertResult.OutsideHouseBounds: { from.SendMessage("That item is not inside a customizable house. Try again."); break; } } from.Target = new DesignInsertTarget(this.m_Foundations, this.m_StaticsOnly); }
public override void OnDoubleClick( Mobile from ) // Override double click of the deed to call our target { if ( !IsChildOf( from.Backpack ) ) // Make sure its in their pack { from.SendLocalizedMessage( 1042001 ); // That must be in your pack for you to use it. } else if ( (from.Followers + 3) < from.FollowersMax + 1 ) { this.Delete(); from.SendMessage( "You use the contract." ); EvoMerc merc = new EvoMerc(); merc.Map = from.Map; merc.Location = from.Location; merc.Controlled = true; merc.ControlMaster = from; merc.IsBonded = true; } else { from.SendMessage( "You have too many followers to hire your Mercenary." ); } }
public override void OnDamage(int amount, Mobile from, bool willKill) { if ( from != null ) { if ( willKill == true ) { from.SendMessage( "Killing this pure and innocent creature has turned you into a criminal!" ); from.Criminal = true; if ( Utility.Random( 5 ) < 1 ) { Revenant rev = new Revenant( this, from, TimeSpan.FromSeconds( 180 ) ); int x = from.X + Utility.RandomMinMax( -2, 2 ); int y = from.Y + Utility.RandomMinMax( -2, 2 ); int z = from.Z; Point3D loc = new Point3D( x, y ,z ); rev.DamageMin = 16; rev.DamageMax = 20; rev.MoveToWorld( loc, from.Map ); from.SendMessage( "A revenant has been sent to revenge the raindeer's death!" ); } } } base.OnDamage(amount, from, willKill); }
public static void StaffAbuse_OnTarget(Mobile from, object obj) { if (from == null || from.Deleted || !(obj is Mobile)) return; Mobile abuser = (Mobile)obj as Mobile; if (abuser != null) { if (abuser.AccessLevel == AccessLevel.Player) { from.SendMessage("The targeted person has accesslevel player. Request canceled."); return; } else if (abuser.AccessLevel == AccessLevel.Administrator) { from.SendMessage("This command does not work on administrators. Request canceled."); return; } if (abuser.Backpack != null) { while (abuser.Backpack.ConsumeTotal(typeof(StaffOrb), 1, true)) { } } abuser.AccessLevel = AccessLevel.Player; abuser.Frozen = true; abuser.MoveToWorld(new Point3D(5275, 1172, 0), Map.Felucca); // move abuser to felucca jail Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Seer, 38, String.Format("Staffmessage: {0} was blamed by {1} for staffpower abusing.", abuser.Name, from.Name)); } }
protected override void OnTarget( Mobile from, object target ) { if ( m_Deed.Deleted || m_Deed.RootParent != from ) return; if ( target is HouseSign ) { HouseSign item = (HouseSign)target; if ( item.RestrictDecay == true ) { from.SendMessage ( "This house is already ageless" ); } else { item.RestrictDecay = true; from.SendMessage ( "The house is now ageless for 60 Days" ); Timer m_timer = new AgelessHouseTimer( item ); m_timer.Start(); m_Deed.Delete(); // Delete the ageless house deed } } else { from.SendMessage ( "You must target a house sign!" ); } }
static public bool soif( Mobile from, int fillFactor ) { if ( from.Thirst >= 20 ) { from.SendMessage( "You are simply too full to drink any more!" ); return false; } int iThirst = from.Thirst + fillFactor; if ( iThirst >= 20 ) { from.Thirst = 20; from.SendMessage( "You manage to drink the beverage, but you are full!" ); } else { from.Thirst = iThirst; if ( iThirst < 5 ) from.SendMessage( "You drink the beverage, but are still extremely thirsty." ); else if ( iThirst < 10 ) from.SendMessage( "You drink the beverage, and begin to feel more satiated." ); else if ( iThirst < 15 ) from.SendMessage( "After drinking the beverage, you feel much less thirsty." ); else from.SendMessage( "You feel quite full after consuming the beverage." ); } return true; }
protected override void OnTarget(Mobile from, object targeted) { if (from != null) { if (targeted != null && targeted is PlayerMobile) { PlayerMobile pm = (PlayerMobile)targeted; DuelPoints dp = null; if (DuelController.PointsTable.TryGetValue(pm.Serial, out dp)) { from.SendGump(new DuelPlayerInfoGump(dp)); } else { if (from == pm) from.SendMessage(53, "You have no dueling record."); else from.SendMessage(53, "That player has no dueling record."); } } else { from.SendMessage(32, "That's not a player!"); } } }
public override void OnDamage( int amount, Mobile from, bool willKill ) { if ( from != null && from.Map != null ) { int amt = 0; Mobile target = this; if ( willKill ) amt = 3 + ((Utility.Random( 6 ) % 5) >> 2); // 20% = 1, 20% = 2, 60% = 0 if ( Hits < 550 ) { double rand = Utility.RandomDouble(); if ( 0.10 > rand ) target = from; if ( 0.20 > rand ) amt++; } if ( amt > 0 ) { SpillAcid( target, amt ); if ( willKill ) from.SendMessage( "Your body explodes into a pile of venom!" ); else from.SendMessage( "The creature spits venom at you!" ); } } base.OnDamage( amount, from, willKill ); }
protected void OnTarget(Mobile from, object targeted) { if (targeted is Item) { Item item = (Item) targeted; if ((item is EtherealMount)) { if (!item.IsChildOf(from.Backpack)) from.SendMessage("The Ethereal Mount must be in your backpack."); else if (item.Hue == 0) { item.Hue = -1; //item.Hue = Hue; } else if (item.Hue == -1) { item.Hue = 0; } } } else { from.SendMessage("You cannot dye that."); } }
protected override void OnTarget( Mobile from, object target ) // Override the protected OnTarget() for our feature { // Check targetted thing is a container if(target is BaseGraveStone) { // Is a container, so cast BaseGraveStone bc = (BaseGraveStone) target; // Check player crafted if(!bc.IsChildOf(from.Backpack)) { from.SendMessage("The gravestone you wish to engrave must be in your backpack."); return; } from.SendMessage("Please enter the words you wish to engrave :"); from.Prompt = new RenamePrompt(from, bc, m_Graver); } else { // Not a container from.SendMessage("This tool can only be used on a gravestone."); } }
public override void OnDoubleClick( Mobile from ) { if( m_Placer == null || m_Placer.Deleted ) m_Placer = from; if( from.InRange( this.GetWorldLocation(), 10 ) ) { if( m_Placer == null || from == m_Placer || from.AccessLevel >= AccessLevel.GameMaster ) { Container c = m_Placer.Backpack; Gold t = new Gold( m_Value ); if( c.TryDropItem( m_Placer, t, true ) ) { this.Delete(); m_Placer.SendMessage( "The item disolves and gives you a refund" ); } else { t.Delete(); m_Placer.SendMessage("For some reason, the refund didn't work! Please page a GM"); } } else { from.SendMessage( "Stay out of my yard!" ); } } else { from.SendMessage( "The item is too far away" ); } }
protected override void OnCantSeeTarget(Mobile from, object targeted) { from.SendMessage("You cannot see that."); from.SendMessage("Select a new target."); from.Target = new DuelTarget(m_Mobile, m_Duel); return; }
static public bool soif( Mobile from, int fillFactor ) { if ( from.Thirst >= 20 ) { from.SendMessage( "ah pu soif!" ); return false; } int iThirst = from.Thirst + fillFactor; if ( iThirst >= 20 ) { from.Thirst = 20; from.SendMessage( "c'est trop bon , mais la vous pouvez plus!" ); } else { from.Thirst = iThirst; if ( iThirst < 5 ) from.SendMessage( "Vous buvez cela , mais avez encore très très soif." ); else if ( iThirst < 10 ) from.SendMessage( "Vous buvez et vous sentez un peu mieux." ); else if ( iThirst < 15 ) from.SendMessage( "Apres avoir vu , vous vous senter bcp mieux." ); else from.SendMessage( "Apres cette boisson , vous etes comblé." ); } return true; }
private bool CheckDrop(Mobile from, Item dropped) { bool valid = false; for (int i = 0; i < m_AllowedReagents.Length; i++) { if (dropped.GetType() == m_AllowedReagents[i]) { valid = true; break; } } if (valid) { int curAmount = 0; List<Item> items = this.Items; foreach (Item item in items) { if (item.GetType() == dropped.GetType()) curAmount += item.Amount; } if ((curAmount + dropped.Amount) > m_MaxReagents) { from.SendMessage("That pouch cannot hold anymore of that type of reagent!"); return false; } else return true; } else { from.SendMessage("You can only place reagents in this pouch."); return false; } }
public override void GiveGift( Mobile mob ) { GiftBox box = new GiftBox(); box.DropItem( new MistletoeDeed() ); box.DropItem( new PileOfGlacialSnow() ); box.DropItem( new LightOfTheWinterSolstice() ); int random = Utility.Random( 100 ); if ( random < 60 ) box.DropItem( new DecorativeTopiary() ); else if ( random < 84 ) box.DropItem( new FestiveCactus() ); else box.DropItem( new SnowyTree() ); switch ( GiveGift( mob, box ) ) { case GiftResult.Backpack: mob.SendMessage( 0x482, "Happy Holidays from the team! Gift items have been placed in your backpack." ); break; case GiftResult.BankBox: mob.SendMessage( 0x482, "Happy Holidays from the team! Gift items have been placed in your bank box." ); break; } }
public override void OnDoubleClick(Mobile from) { var backpack = from.Backpack; var item1 = (BronzeIngot) backpack.FindItemByType(typeof (BronzeIngot)); if (item1 != null) { BaseIngot m_Ore1 = item1; var toConsume = m_Ore1.Amount; if ((m_Ore1.Amount > 499) && (m_Ore1.Amount < 501)) { m_Ore1.Delete(); from.SendMessage("You've successfully converted the Metal."); from.AddToBackpack(new ValoriteIngot(500)); Delete(); } else if ((m_Ore1.Amount < 500) || (m_Ore1.Amount > 500)) { from.SendMessage("You can only convert 500 Bronze Ingots at a time."); } } else { from.SendMessage("There isn't Bronze Ingots in your Backpack."); } }
public override void OnDoubleClick( Mobile m ) { Item a = m.Backpack.FindItemByType( typeof(EnchantedRope) ); if ( a != null ) { Item b = m.Backpack.FindItemByType( typeof(GlowingShipModel) ); if ( b != null ) { Item c = m.Backpack.FindItemByType( typeof(SacredAnchor) ); if ( c != null ) { Item d = m.Backpack.FindItemByType( typeof(SpecialSeaMap) ); if ( d != null ) { m.AddToBackpack( new MasterOfTheSeaChest() ); a.Delete(); b.Delete(); c.Delete(); d.Delete(); m.SendMessage( "You place the artifacts into the Sea Chest for a Full Master of the Sea Chest!" ); Delete(); } } } } else { m.SendMessage( "You are missing some artifacts." ); } }
public bool OnPlacement(Mobile from, HouseSurveyTool tool, Point3D p) { if (!from.CheckAlive() || from.Backpack == null || tool == null || tool.UsesRemaining == 0 || !tool.IsChildOf(from.Backpack)) { return(false); } if (SurveyPreviewHouse.PreviewHouseList.Contains(from)) { from.SendMessage("You are already previewing a potential house location."); return(false); } ArrayList toMove; Point3D center = new Point3D(p.X - m_Offset.X, p.Y - m_Offset.Y, p.Z - m_Offset.Z); HousePlacementResult res = HousePlacement.Check(from, m_MultiID, center, out toMove, false); switch (res) { case HousePlacementResult.Valid: { from.SendMessage("This is valid terrain to place a house."); // This is a valid location. SurveyPreviewHouse prev = new SurveyPreviewHouse(m_MultiID, from); MultiComponentList mcl = prev.Components; prev.MoveToWorld(center, from.Map); string message = "You have found valid terrain to place a house. This preview will stay visible for 20 seconds.<BR><BR>Press OKAY to stop previewing this house."; from.SendGump(new NoticeGump(1060635, 30720, message, 0xFFC000, 420, 280, new NoticeGumpCallback(SurveyNotice_Callback), prev)); return(true); } case HousePlacementResult.MobileBlocking: { from.SendMessage("There is somebody in the way, and you can't place on top of them!"); break; } case HousePlacementResult.ItemBlocking: { from.SendMessage("There is an item in the way, and you can't place on top of them!"); break; } case HousePlacementResult.BadItem: case HousePlacementResult.BadLand: case HousePlacementResult.BadStatic: case HousePlacementResult.BadRegionHidden: case HousePlacementResult.NoSurface: { from.SendLocalizedMessage(1043287); // The house could not be created here. Either something is blocking the house, or the house would not be on valid terrain. break; } case HousePlacementResult.BadRegion: { from.SendLocalizedMessage(501265); // Housing cannot be created in this area. break; } case HousePlacementResult.BadRegionTemp: { from.SendLocalizedMessage(501270); //Lord British has decreed a 'no build' period, thus you cannot build this house at this time. break; } } return(false); }
public static void Password_OnCommand(CommandEventArgs e) { Mobile from = e.Mobile; Account acct = from.Account as Account; if (acct == null) { return; } IPAddress[] accessList = acct.LoginIPs; if (accessList.Length == 0) { return; } NetState ns = from.NetState; if (ns == null) { return; } if (e.Length == 0) { from.SendMessage("You must specify the new password."); return; } else if (e.Length == 1) { from.SendMessage("To prevent potential typing mistakes, you must type the password twice. Use the format:"); from.SendMessage("Password \"(newPassword)\" \"(repeated)\""); return; } string pass = e.GetString(0); string pass2 = e.GetString(1); if (pass != pass2) { from.SendMessage("The passwords do not match."); return; } bool isSafe = true; for (int i = 0; isSafe && i < pass.Length; ++i) { isSafe = (pass[i] >= 0x20 && pass[i] < 0x7F); } if (!isSafe) { from.SendMessage("That is not a valid password."); return; } try { IPAddress ipAddress = ns.Address; if (Utility.IPMatchClassC(accessList[0], ipAddress)) { acct.SetPassword(pass); from.SendMessage("The password to your account has changed."); } else { PageEntry entry = PageQueue.GetEntry(from); if (entry != null) { if (entry.Message.StartsWith("[Automated: Change Password]")) { from.SendMessage("You already have a password change request in the help system queue."); } else { from.SendMessage("Your IP address does not match that which created this account."); } } else if (PageQueue.CheckAllowedToPage(from)) { from.SendMessage("Your IP address does not match that which created this account. A page has been entered into the help system on your behalf."); from.SendLocalizedMessage(501234, "", 0x35); /* The next available Counselor/Game Master will respond as soon as possible. * Please check your Journal for messages every few minutes. */ PageQueue.Enqueue(new PageEntry(from, String.Format("[Automated: Change Password]<br>Desired password: {0}<br>Current IP address: {1}<br>Account IP address: {2}", pass, ipAddress, accessList[0]), PageType.Account)); } } } catch { } }
protected virtual void ApplyName(Mobile m, TEntity t, string name) { if (m == null || t == null) { return; } if (String.IsNullOrWhiteSpace(name)) { m.SendMessage(0x22, "You cannot use a blank name."); OpenGump(m, t); return; } name = Utility.FixHtml(name.Trim()); if (!NameVerification.Validate(name, 2, 20, true, t is Item, true, 1, NameVerification.SpaceDashPeriodQuote)) { m.SendMessage(0x22, "That name is unacceptable."); OpenGump(m, t); return; } var item = t as Item; if (item != null) { if (item.Name == name) { m.SendMessage(0x22, "The item is already named {0}.", name); OpenGump(m, t); return; } item.Name = name; m.SendMessage(0x55, "The item has been renamed."); Delete(); return; } var mob = t as Mobile; if (mob != null) { if (mob.RawName == name) { m.SendMessage(0x22, "{0} are already named {1}.", mob == m ? "You" : "They", name); OpenGump(m, t); return; } mob.RawName = name; m.SendMessage(0x55, "{0} name has been changed.", mob == m ? "Your" : "Their"); Delete(); if (mob is PlayerMobile) { var pm = (PlayerMobile)mob; PlayerNames.Register(pm); PlayerNames.ValidateSharedName(pm); } return; } m.SendMessage(0x22, "Could not rename that object."); }
protected virtual void OpenGump(Mobile m, TEntity t) { if (_Gump != null) { _Gump.Close(); _Gump = null; } if (Names != null && Names.Count > 0) { m.SendMessage("Select a name from the registry..."); var opts = new MenuGumpOptions(); foreach (var name in Names.OrderByNatural()) { var n = name; opts.AppendEntry( new ListGumpEntry( n, () => { _Gump = null; ApplyName(m, t, n); })); } var menu = new MenuGump(m, null, opts); menu.OnActionClose += HandleGumpClose; _Gump = menu.Send(); } else { string name; int limit; if (t is Item) { name = (t as Item).Name; limit = 20; } else if (t is Mobile) { name = (t as Mobile).RawName; limit = 20; } else { name = String.Empty; limit = 0; } var dialog = new InputDialogGump(m) { Title = "Name Selection", Html = "Type the name you wish to use and click OK to accept.", InputText = name ?? String.Empty, Limit = limit, Callback = (b, n) => { _Gump = null; ApplyName(m, t, n); } }; dialog.OnActionClose += HandleGumpClose; _Gump = dialog.Send(); } }
protected override void OnTarget(Mobile from, object targeted) { if (from == null || this.m_tool == null || from.Map == null) { return; } // find any xmlsiege attachment on the target XmlSiege a = (XmlSiege)XmlAttach.FindAttachment(targeted, typeof(XmlSiege)); // if it isnt on the target, but the target is an addon, then check the addon if (a == null && targeted is AddonComponent) { a = (XmlSiege)XmlAttach.FindAttachment(((AddonComponent)targeted).Addon, typeof(XmlSiege)); } // if it still isnt found, the look for nearby targets if (a == null) { Point3D loc = Point3D.Zero; if (targeted is IEntity) { loc = ((IEntity)targeted).Location; } else if (targeted is StaticTarget) { loc = ((StaticTarget)targeted).Location; } else if (targeted is LandTarget) { loc = ((LandTarget)targeted).Location; } if (loc != Point3D.Zero) { foreach (Item p in from.Map.GetItemsInRange(loc, RepairRange)) { a = (XmlSiege)XmlAttach.FindAttachment(p, typeof(XmlSiege)); if (a != null) { break; } } } } // repair the target if (a != null) { if (a.Hits >= a.HitsMax) { from.SendMessage("This does not require repair."); return; } if (a.BeingRepaired) { from.SendMessage("You must wait to repair again."); return; } Container pack = from.Backpack; // does the player have it? if (pack != null) { int nhits = 0; double resourcepenalty = 1; // require more resources for repairing destroyed structures if (a.Hits == 0) { resourcepenalty = RepairDestroyedResourcePenalty; } // dont consume resources for staff if (from.AccessLevel > AccessLevel.Player) { resourcepenalty = 0; } int requirediron = (int)(a.Iron * resourcepenalty); int requiredstone = (int)(a.Stone * resourcepenalty); int requiredwood = (int)(a.Wood * resourcepenalty); int niron = pack.ConsumeUpTo(typeof(IronIngot), requirediron); int nstone = pack.ConsumeUpTo(typeof(BaseGranite), requiredstone); int nwood = pack.ConsumeUpTo(typeof(Board), requiredwood); if (niron == requirediron && nstone == requiredstone && nwood == requiredwood) { nhits += this.m_tool.HitsPerRepair; } if (nhits == 0) { from.SendMessage("Insufficient resources to complete the repair. Resources lost."); return; } from.PlaySound(0x2A); // play anvil sound from.SendMessage("You begin your repair"); this.m_tool.UsesRemaining--; if (this.m_tool.UsesRemaining == 0) { from.SendLocalizedMessage(1044038); // You have worn out your tool! this.m_tool.Delete(); } a.BeingRepaired = true; double smithskill = from.Skills[SkillName.Blacksmith].Value; double carpentryskill = from.Skills[SkillName.Carpentry].Value; double timepenalty = 1; if (a.Hits == 0) { // repairing destroyed structures requires more time timepenalty = RepairDestroyedTimePenalty; } // compute repair speed with modifiers TimeSpan repairtime = TimeSpan.FromSeconds(this.m_tool.BaseRepairTime * timepenalty - from.Dex / 40.0 - smithskill / 50.0 - carpentryskill / 50.0); // allow staff instant repair if (from.AccessLevel > AccessLevel.Player) { repairtime = TimeSpan.Zero; } // setup for the delayed repair Timer.DelayCall(repairtime, new TimerStateCallback(SiegeRepair_Callback), new object[] { from, a, nhits }); } } else { from.SendMessage("Invalid target"); return; } }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; PlayerMobile pm = (PlayerMobile)from; if (from == null) { return; } if (info.ButtonID == 0) { from.CloseGump(typeof(PvpRewardGump)); from.SendGump(new PvpRewardGump()); } if (info.ButtonID == 1) { if (pm.TotalPoints >= m_Cost1) { pm.TotalPoints -= m_Cost1; pm.TotalPointsSpent += m_Cost1; from.SendMessage("You buy the item."); from.AddToBackpack(new Gold()); } else { from.SendMessage("You lack the pvp points to buy this item."); } } if (info.ButtonID == 2) { if (pm.TotalPoints >= m_Cost2) { pm.TotalPoints -= m_Cost2; pm.TotalPointsSpent += m_Cost2; from.SendMessage("You buy the item."); from.AddToBackpack(new Gold()); } else { from.SendMessage("You lack the pvp points to buy this item."); } } if (info.ButtonID == 3) { if (pm.TotalPoints >= m_Cost3) { pm.TotalPoints -= m_Cost3; pm.TotalPointsSpent += m_Cost3; from.SendMessage("You buy the item."); from.AddToBackpack(new Gold()); } else { from.SendMessage("You lack the pvp points to buy this item."); } } if (info.ButtonID == 4) { if (pm.TotalPoints >= m_Cost4) { pm.TotalPoints -= m_Cost4; pm.TotalPointsSpent += m_Cost4; from.SendMessage("You buy the item."); from.AddToBackpack(new Gold()); } else { from.SendMessage("You lack the pvp points to buy this item."); } } if (info.ButtonID == 5) { if (pm.TotalPoints >= m_Cost5) { pm.TotalPoints -= m_Cost5; pm.TotalPointsSpent += m_Cost5; from.SendMessage("You buy the item."); from.AddToBackpack(new Gold()); } else { from.SendMessage("You lack the pvp points to buy this item."); } } }
public override void OnDoubleClick(Mobile m) { m.SendMessage("the tooth from a troll that can be sold to butchers."); m.PlaySound(367); }
public override void OnResponse(NetState sender, RelayInfo info) { Mobile from = sender.Mobile; if (info.ButtonID == 0 || m_hive.Deleted || !from.InRange(m_hive.GetWorldLocation(), 3)) { return; } if (!m_hive.IsAccessibleTo(from)) { m_hive.LabelTo(from, "You cannot use that."); return; } switch (info.ButtonID) { case (int)Buttons.butExit: //Exit back to main gump { from.SendGump(new BeehiveMainGump(from, m_hive)); break; } case (int)Buttons.butHoney: //Honey { //ToDo: get hurt or poisoned when harvesting Item hivetool = GetHiveTool(from); if (NeedHiveTool) { if (hivetool == null || !(hivetool is HiveTool)) { m_hive.LabelTo(from, "You need a hive tool to extract the excess honey!"); from.SendGump(new BeehiveProductionGump(from, m_hive)); return; } } if (m_hive.Honey < 3) { m_hive.LabelTo(from, "There isn't enough honey in the hive to fill a bottle!"); from.SendGump(new BeehiveProductionGump(from, m_hive)); break; } Container pack = from.Backpack; if (pack != null && pack.ConsumeTotal(typeof(Bottle), 1)) { JarHoney honey = new JarHoney(); if (!from.PlaceInBackpack(honey)) { honey.Delete(); from.PlaceInBackpack(new Bottle()); //add the consumed bottle m_hive.LabelTo(from, "There is not enough room in your backpack for the honey!"); from.SendGump(new BeehiveProductionGump(from, m_hive)); break; } if (NeedHiveTool) { ((HiveTool)hivetool).UsesRemaining--; if (((HiveTool)hivetool).UsesRemaining < 1) { from.SendMessage("You wear out the hive tool."); hivetool.Delete(); } } m_hive.Honey -= 3; m_hive.LabelTo(from, "You fill a bottle with golden honey and place it in your pack."); from.SendGump(new BeehiveProductionGump(from, m_hive)); break; } else { m_hive.LabelTo(from, "You need a bottle to fill with honey!"); from.SendGump(new BeehiveProductionGump(from, m_hive)); break; } } case (int)Buttons.butWax: //Wax { //ToDo: get hurt or poisoned when harvesting Item hivetool = GetHiveTool(from); if (NeedHiveTool) { if (hivetool == null || !(hivetool is HiveTool)) { m_hive.LabelTo(from, "You need a hive tool to scrape the excess beeswax!"); from.SendGump(new BeehiveProductionGump(from, m_hive)); return; } } if (m_hive.Wax < 1) { m_hive.LabelTo(from, "There isn't enough excess wax in the hive to harvest!"); return; } Item wax; if (PureWax) { wax = new Beeswax(m_hive.Wax); } else { wax = new RawBeeswax(m_hive.Wax); } if (!from.PlaceInBackpack(wax)) { wax.Delete(); m_hive.LabelTo(from, "There is not enough room in your backpack for the wax!"); from.SendGump(new BeehiveProductionGump(from, m_hive)); break; } if (NeedHiveTool) { ((HiveTool)hivetool).UsesRemaining--; if (((HiveTool)hivetool).UsesRemaining < 1) { from.SendMessage("You wear out the hive tool."); hivetool.Delete(); } } m_hive.Wax = 0; m_hive.LabelTo(from, "You collect the excess beeswax and place it in your pack."); from.SendGump(new BeehiveProductionGump(from, m_hive)); break; } } }
protected override void OnTarget(Mobile from, object target) { if (target is Mobile) { if (from.CheckTargetSkill(SkillName.Forensics, target, 40.0, 100.0)) { PlayerMobile pm = target as PlayerMobile; bool msg = false; if (pm != null) { if (pm.NpcGuild == NpcGuild.ThievesGuild) { from.SendLocalizedMessage(501004);//That individual is a thief! msg = true; } if (pm.HasTempStatLoss) { from.SendMessage("That individual will receive temporary skill and stat loss if they are killed."); msg = true; } } if (!msg) { from.SendLocalizedMessage(501003);//You notice nothing unusual. } } else { from.SendLocalizedMessage(501001);//You cannot determain anything useful. } } else if (target is Corpse) { if (from.CheckTargetSkill(SkillName.Forensics, target, 0.0, 100.0)) { Corpse c = (Corpse)target; if (((Body)c.Amount).IsHuman) { c.LabelTo(from, 1042751, (c.Killer == null ? "no one" : c.Killer.Name));//This person was killed by ~1_KILLER_NAME~ } if (c.Looters.Count > 0) { StringBuilder sb = new StringBuilder(); for (int i = 0; i < c.Looters.Count; i++) { if (i > 0) { sb.Append(", "); } sb.Append(((Mobile)c.Looters[i]).Name); } c.LabelTo(from, 1042752, sb.ToString());//This body has been distrubed by ~1_PLAYER_NAMES~ } else { c.LabelTo(from, 501002);//The corpse has not be desecrated. } } else { from.SendLocalizedMessage(501001);//You cannot determain anything useful. } } else if (target is TrapableContainer) { if (from.CheckTargetSkill(SkillName.Forensics, target, 25.0, 100.0)) { if (((TrapableContainer)target).Trapped) { from.SendAsciiMessage("That container looks very suspicious."); } else { from.SendLocalizedMessage(501003);//You notice nothing unusual. } } else { from.SendLocalizedMessage(501001);//You cannot determain anything useful. } } if (target is ILockpickable) { ILockpickable p = (ILockpickable)target; if (p.Picker != null) { from.SendLocalizedMessage(1042749, p.Picker.Name);//This lock was opened by ~1_PICKER_NAME~ } else { from.SendLocalizedMessage(501003);//You notice nothing unusual. } } }
public override void OnDoubleClick(Mobile m) { m.SendMessage("Finlor's Letter to Snyden of Cove."); }
public override void OnResponse(NetState state, RelayInfo info) { Mobile from = state.Mobile; if (from == null || m_skb.Deleted || !m_skb.IsChildOf(from.Backpack)) { return; } if (info.ButtonID > 0 && info.ButtonID < from.Skills.Length) { m_Skill = from.Skills[(info.ButtonID - 1)]; if (m_Skill == null || !AllowedSkill(m_Skill)) { return; } double count = from.Skills.Total / 10.0; double cap = from.SkillsCap / 10.0; ArrayList decreased = new ArrayList(); double decreaseamount = 0.0; double bonuscopy = m_skb.SkillBonus; if ((count + bonuscopy) > cap) { for (int i = 0; i < from.Skills.Length; i++) { if (from.Skills[i].Lock == SkillLock.Down && from.Skills[i].Base > 0.0) { decreased.Add(from.Skills[i]); decreaseamount += from.Skills[i].Base; } } if (decreaseamount <= 0) { from.SendMessage("You have exceeded the skill cap and do not have a skill set to be decreased."); return; } } if (m_Skill.Base + bonuscopy <= 100) { if ((cap - count) + decreaseamount >= bonuscopy) { if (cap - count >= bonuscopy) { m_Skill.Base += bonuscopy; bonuscopy = 0; } else { m_Skill.Base += bonuscopy; bonuscopy -= cap - count; foreach (Skill s in decreased) { if (s.Base >= bonuscopy) { s.Base -= bonuscopy; bonuscopy = 0; } else { bonuscopy -= s.Base; s.Base = 0; } if (bonuscopy == 0) { break; } } } m_skb.Delete(); ((PlayerMobile)from).Young = false; } else { from.SendMessage("You must have enough skill set down to compensate for the skill gain."); } } else { from.SendMessage("You have to choose another skill."); } } }
public override void OnResponse(NetState sender, RelayInfo info) { if (m_FacialHair && (m_From.Female || m_From.Body.IsFemale)) { return; } if (m_From.Race == Race.Elf) { m_From.SendMessage("This isn't implemented for elves yet. Sorry!"); return; } if (info.ButtonID == 1) { var switches = info.Switches; if (switches.Length > 0) { var index = switches[0]; if (index >= 0 && index < m_Entries.Length) { var entry = m_Entries[index]; (m_From as PlayerMobile)?.SetHairMods(-1, -1); var hairID = m_From.HairItemID; var facialHairID = m_From.FacialHairItemID; if (entry.ItemID == 0) { if (m_FacialHair ? facialHairID == 0 : hairID == 0) { return; } if (Banker.Withdraw(m_From, m_Price)) { if (m_FacialHair) { m_From.FacialHairItemID = 0; } else { m_From.HairItemID = 0; } } else { m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042293, m_From.NetState ); // You cannot afford my services for that style. } } else { if (m_FacialHair) { if (facialHairID > 0 && facialHairID == entry.ItemID) { return; } } else { if (hairID > 0 && hairID == entry.ItemID) { return; } } if (Banker.Withdraw(m_From, m_Price)) { if (m_FacialHair) { m_From.FacialHairItemID = entry.ItemID; } else { m_From.HairItemID = entry.ItemID; } } else { m_Vendor.PrivateOverheadMessage( MessageType.Regular, 0x3B2, 1042293, m_From.NetState ); // You cannot afford my services for that style. } } } } else { // You decide not to change your hairstyle. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState); } } else { // You decide not to change your hairstyle. m_Vendor.PrivateOverheadMessage(MessageType.Regular, 0x3B2, 1013009, m_From.NetState); } }
public virtual void OnDisallowedRider(Mobile m) { m.SendMessage("Cette monture refuse que vous la montiez"); }
public override void OnDoubleClick(Mobile from) { if (m_sower == null || m_sower.Deleted) { m_sower = from; } if (from != m_sower) { from.SendMessage("You do not own this plant !!!"); return; } if (from.Mounted && !CropHelper.CanWorkMounted) { from.SendMessage("You cannot harvest a crop while mounted."); return; } if (DateTime.UtcNow > lastpicked.AddSeconds(3)) { lastpicked = DateTime.UtcNow; int cookValue = (int)from.Skills[SkillName.Cooking].Value / 20; if (cookValue == 0) { from.SendMessage("You have no idea how to harvest this crop."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); } else { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0); m_lastvisit = DateTime.UtcNow; if (cookValue > m_yield) { cookValue = m_yield + 1; } int pick = Utility.RandomMinMax(cookValue - 4, cookValue); if (pick < 0) { pick = 0; } if (pick == 0) { from.SendMessage("You do not manage to harvest any crops."); return; } m_yield -= pick; from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s")); if (m_yield < 1) { ((Item)this).ItemID = pickedGraphic; } Pistacio crop = new Pistacio(pick); from.AddToBackpack(crop); if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
public override void OnResponse(Mobile from, string text) { m_mscroll.Message = m_mscroll.Message + text; from.SendMessage("Enter your signature"); from.Prompt = new SenderPrompt(m_mscroll); }
public override void OnDoubleClick(Mobile from) { if (IsDeadPet) { return; } if (from.IsBodyMod && !from.Body.IsHuman) { if (Core.AOS) // You cannot ride a mount in your current form. { PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "Vous ne pouvez chevaucher sous cette forme", from.NetState); } else { from.SendMessage("Vous ne pouvez chevaucher sous une autre forme"); // You can't do that while polymorphed. } return; } if (!CheckMountAllowed(from)) { return; } if (from.Mounted) { from.SendMessage("Descendez d'abord de votre monture"); // Please dismount first. return; } if (from.Female ? !AllowFemaleRider : !AllowMaleRider) { OnDisallowedRider(from); return; } if (!Multis.DesignContext.Check(from)) { return; } if (from.HasTrade) { from.SendMessage("Vous ne pouvez chevaucher en ce moment", "", 0x41); // You may not ride at this time return; } if (from.InRange(this, 1)) { bool canAccess = (from.AccessLevel >= AccessLevel.GameMaster) || (Controlled && ControlMaster == from) || (Summoned && SummonMaster == from); if (canAccess) { if (this.Poisoned) { PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "Cette monture est trop malade pour se laisser monter", from.NetState); // This mount is too ill to ride. } else { Rider = from; } } else if (!Controlled && !Summoned) { // That mount does not look broken! You would have to tame it to ride it. PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "Cette monture est farouche! Il vous faudra d'abord l'apprivoiser", from.NetState); } else { // This isn't your mount; it refuses to let you ride. PrivateOverheadMessage(Network.MessageType.Regular, 0x3B2, false, "Cette monture n'est pas la votre, elle refuse que vous la montiez", from.NetState); } } else { from.SendMessage("Vous êtes trop loin pour chevaucher"); // That is too far away to ride. } }
public override void OnResponse(Mobile from, string text) { m_mscroll.Addressee = text; from.SendMessage("Enter message part 1"); from.Prompt = new MessagePrompt1(m_mscroll); }
public override void OnResponse(Mobile from, string text) { m_mscroll.Sender = text; from.SendMessage("Your message is completed!"); m_mscroll.Name = "A message scroll addressed to " + m_mscroll.Addressee; }
public override bool OnFailDisarm(Mobile from) { bool bExploded = false; double rtskill = from.Skills[SkillName.RemoveTrap].Value; double chance = (TrapPower - rtskill) / 800; //make sure there's some chance to trip if (chance <= 0) { chance = .005; //minimum of 1/200 trip } if (chance >= 1) { chance = .995; } chance *= TrapSensitivity; //debug message only available to non-Player level if (from.AccessLevel > AccessLevel.Player) { from.SendMessage("Chance to trip trap: " + chance); } if (Utility.RandomDouble() < chance) { //trap is tripped, effect disarmer int damage = TrapPower / 2 + (Utility.Random(4, 12) * TrapPower / 25) - (int)rtskill / 5; int traptype = 0; traptype = Utility.Random(0, 3); switch (traptype) { case 0: //explosion { from.SendLocalizedMessage(502999); // You set off a trap! if (from.InRange(GetWorldLocation(), 2)) { AOS.Damage(from, damage, 0, 100, 0, 0, 0); from.SendLocalizedMessage(503000); // Your skin blisters from the heat! } Point3D loc = GetWorldLocation(); Effects.PlaySound(loc, Map, 0x307); Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x36BD, 15); break; } case 1: //dart { from.SendLocalizedMessage(502999); // You set off a trap! if (from.InRange(GetWorldLocation(), 2)) { AOS.Damage(from, damage / 2, 100, 0, 0, 0, 0); from.SendLocalizedMessage(502380); // A dart embeds... } Point3D loc = GetWorldLocation(); Effects.PlaySound(loc, Map, 0x223); //What effect?!? //Effects.SendLocationEffect( new Point3D( loc.X + 1, loc.Y + 1, loc.Z - 11 ), Map, 0x36BD, 15 ); break; } case 2: //poison { from.SendLocalizedMessage(502999); // You set off a trap! if (from.InRange(GetWorldLocation(), 2)) { Poison p = Poison.Lesser; if (damage >= 30) { p = Poison.Regular; } if (damage >= 60) { p = Poison.Greater; } if (damage >= 90) { p = Poison.Deadly; } if (damage >= 100) { p = Poison.Lethal; } from.ApplyPoison(from, p); from.SendLocalizedMessage(503004); // You are enveloped... } Point3D loc = GetWorldLocation(); Effects.PlaySound(loc, Map, 0x231); Effects.SendLocationEffect(new Point3D(loc.X + 1, loc.Y + 1, loc.Z - 11), Map, 0x11A6, 20); break; } } from.RevealingAction(); bExploded = true; } return(bExploded); }
public override void OnResponse(Mobile from, string text) { m_mscroll.Message = m_mscroll.Message + text; from.SendMessage("Enter message part 4"); from.Prompt = new MessagePrompt4(m_mscroll); }
public static TimeSpan OnUse(Mobile m) { m.Target = new InternalTarget(); m.SendMessage("Whose pocket do you wish to pick?"); return(TimeSpan.FromSeconds(4.0)); }
public override void OnItemLifted(Mobile from, Item item) { bool notYetLifted = !m_Lifted.Contains(item); from.RevealingAction(); // prevent the player from milking the chest by removing 'one from a stack' if (notYetLifted) { ArrayList tx = new ArrayList(FindItemsByType(item.GetType(), true)); tx.Remove(item); if (tx.Count > 0) { foreach (Item ix in tx) { if (ix.Amount > 1) { // player looks to be removing one from a stack // disqualify the one they lifted m_Lifted.Add(item); notYetLifted = false; break; } } // if they lifted >= 1, and left 1 disqualify the one they lifted if (notYetLifted) { if (item.Amount > 1) { m_Lifted.Add(item); notYetLifted = false; } } } } if (notYetLifted) { m_Lifted.Add(item); double chance = 0.1 * (Level * .5); if (IsThemed == true && 0.1 >= Utility.RandomDouble()) { // 10% chance to spawn 2 monsters as is a Themed chest TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false); TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false); } else if (IsThemed == false && chance >= Utility.RandomDouble()) { TreasureTheme.Spawn(m_Level, GetWorldLocation(), Map, from, IsThemed, m_type, false, false); } // Adam: Insure IOB wearers are not stealing from their kin BaseCreature witness = null; if (CheckThief(from, out witness)) { from.SendMessage("You have been discovered stealing from your kin!"); if (from.Hidden) { from.RevealingAction(); } // attack kin to make them come after you from.DoHarmful(witness); } } base.OnItemLifted(from, item); }
protected override void OnTarget(Mobile from, object targeted) { if (m_Dagger.Deleted) { return; } else if (!from.Items.Contains(m_Dagger)) { from.SendMessage("You must be holding that weapon to use it."); } else if (targeted is Mobile) { Mobile m = (Mobile)targeted; if (m != from && from.HarmfulCheck(m)) { Direction to = from.GetDirectionTo(m); from.Direction = to; from.Animate(from.Mounted ? 26 : 9, 7, 1, true, false, 0); if (Utility.RandomDouble() >= (Math.Sqrt(m.Dex / 100.0) * 0.8)) { from.MovingEffect(m, 0x1BFE, 7, 1, false, false, 0x481, 0); AOS.Damage(m, from, Utility.Random(5, from.Str / 10), 100, 0, 0, 0, 0); m_Dagger.MoveToWorld(m.Location, m.Map); } else { int x = 0, y = 0; switch (to & Direction.Mask) { case Direction.North: --y; break; case Direction.South: ++y; break; case Direction.West: --x; break; case Direction.East: ++x; break; case Direction.Up: --x; --y; break; case Direction.Down: ++x; ++y; break; case Direction.Left: --x; ++y; break; case Direction.Right: ++x; --y; break; } x += Utility.Random(-1, 3); y += Utility.Random(-1, 3); x += m.X; y += m.Y; m_Dagger.MoveToWorld(new Point3D(x, y, m.Z), m.Map); from.MovingEffect(m_Dagger, 0x1BFE, 7, 1, false, false, 0x481, 0); from.SendMessage("You miss."); } } } }
protected override void OnTarget(Mobile from, object targeted) { from.RevealingAction(); LokaiSkill lokaiSkill = (LokaiSkillUtilities.XMLGetSkills(from)).PickPocket; if (targeted is Mobile) { Mobile mobile = targeted as Mobile; Container pack = mobile.Backpack; if (!from.InRange(mobile.Location, 1)) { from.NextSkillTime = Core.TickCount; from.SendMessage("You are too far away to do that."); return; } else if (pack == null) { from.NextSkillTime = Core.TickCount; from.SendMessage("That target has no backpack."); return; } else if (!from.CheckAlive()) { from.NextSkillTime = Core.TickCount; from.SendMessage("You cannot do that while you are dead."); return; } else if (!mobile.CheckAlive()) { from.NextSkillTime = Core.TickCount; from.SendMessage("That is dead, so you cannot do that."); return; } else if (mobile == from) { from.NextSkillTime = Core.TickCount; from.SendMessage("You wish to pick your own pocket?"); return; } else { bool withoutNotice = true; if (targeted is PlayerMobile) { if (ALLOW_PLAYER_THEFT) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 40.0, 100.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else { from.SendMessage("Pick-pocketing players is not allowed around here!"); } } else if (targeted is BaseVendor) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 0.0, 60.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else if (targeted is BaseCreature && (!((targeted as BaseCreature).Controlled && (targeted as BaseCreature).ControlMaster == from))) { SuccessRating rating = LokaiSkillUtilities.CheckLokaiSkill(from, lokaiSkill, 20.0, 80.0); withoutNotice = PickTry(from, mobile, rating, lokaiSkill, pack); } else { from.NextSkillTime = Core.TickCount; from.SendMessage("You may not pick their pocket."); return; } if (!withoutNotice) { if (mobile is PlayerMobile) { from.CriminalAction(true); from.OnHarmfulAction(mobile, from.Criminal); } else if (mobile is BaseVendor) { mobile.Direction = mobile.GetDirectionTo(from); from.Direction = from.GetDirectionTo(mobile); mobile.Animate(31, 5, 1, true, false, 0); mobile.Say(Utility.RandomList(1005560, 1013046, 1079127, 1013038, 1013039, 1010634)); from.Animate(20, 5, 1, true, false, 0); from.Damage(Math.Max((Utility.Random(3) + 3), (int)(from.Hits / (Utility.Random(8) + 8)))); } else if (mobile is BaseCreature) { (mobile as BaseCreature).AggressiveAction(from, from.Criminal); } } } } else { from.SendMessage("That does not have a pocket you can pick."); } }
public void OnTarget(Mobile from, object targeted) { if (!(from is PlayerMobile) || !((PlayerMobile)from).BasketWeaving) { from.SendLocalizedMessage(1112253); //You haven't learned basket weaving. Perhaps studying a book would help! } else if (targeted is DryReeds) { DryReeds reed1 = (DryReeds)targeted; Container cont = from.Backpack; Server.Engines.Plants.PlantHue hue = reed1.PlantHue; if (!reed1.IsChildOf(from.Backpack)) { from.SendLocalizedMessage(1116249); //That must be in your backpack for you to use it. } else if (cont != null) { Item[] items = cont.FindItemsByType(typeof(DryReeds)); List <Item> list = new List <Item>(); int total = 0; foreach (Item item in items) { if (item is DryReeds) { DryReeds check = (DryReeds)item; if (reed1.PlantHue == check.PlantHue) { total += item.Amount; list.Add(item); } } } int toConsume = 2; if (list.Count > 0 && total > 1) { foreach (Item item in list) { if (item.Amount >= toConsume) { item.Consume(toConsume); toConsume = 0; } else if (item.Amount < toConsume) { item.Delete(); toConsume -= item.Amount; } if (toConsume <= 0) { break; } } SoftenedReeds sReed = new SoftenedReeds(hue); if (!from.Backpack.TryDropItem(from, sReed, false)) { sReed.MoveToWorld(from.Location, from.Map); } m_UsesRemaining--; if (m_UsesRemaining <= 0) { Delete(); } else { InvalidateProperties(); } from.PlaySound(0x23E); } else { from.SendLocalizedMessage(1112250); //You don't have enough of this type of dry reeds to make that. } } return; } if (targeted is Item && BasePigmentsOfTokuno.IsValidItem((Item)targeted)) { from.PlaySound(0x23E); from.SendMessage("You scour any color from the item."); ((Item)targeted).Hue = 0; this.Consume(); } else { from.SendMessage("You cannot scour that!"); } }
private bool PickTry(Mobile from, Mobile mobile, SuccessRating rating, LokaiSkill lokaiSkill, Container pack) { bool pickGold, pickItem; bool pickNone = false; Item[] goldItems = pack.FindItemsByType(typeof(Gold)); int goldAmount = 0; foreach (Item item in goldItems) { goldAmount += item.Amount; } List <Item> pickables = new List <Item>(); Search(pack, ref pickables); if (pickables.Count > 0) { pickItem = true; } else { pickItem = false; } if (goldAmount > 0) { pickGold = true; } else { pickGold = false; } if (!pickGold && !pickItem) { pickNone = true; } else if (pickGold && pickItem) { pickGold = Utility.RandomBool(); pickItem = !pickGold; } if (rating >= SuccessRating.PartialSuccess) { if (pickNone) { from.NextSkillTime = Core.TickCount; from.SendMessage("Their pockets are empty."); } else if (pickGold) { int pickAmount = Math.Min((int)(4 * lokaiSkill.Value), (int)(goldAmount / 1000)); if ((INFINITE_GOLD && !(mobile is PlayerMobile) || (goldAmount > 10 && pickAmount < 10))) { pickAmount = Utility.Random(6) + 5; } if (goldAmount > 100 && rating >= SuccessRating.CompleteSuccess && pickAmount < 100) { pickAmount = Utility.Random(61) + 40; } if (goldAmount > 500 && rating >= SuccessRating.ExceptionalSuccess && pickAmount < 500) { pickAmount = Utility.Random(301) + 200; } if (from.AddToBackpack(new Gold(pickAmount))) { if ((mobile is PlayerMobile && pack.ConsumeTotal(typeof(Gold), pickAmount) || (!INFINITE_GOLD && pack.ConsumeTotal(typeof(Gold), pickAmount)))) { from.SendMessage("You were able to pick {0} gold from their pocket!", pickAmount.ToString()); } else { from.SendMessage("You find {0} gold in their pocket!", pickAmount.ToString()); } } } else { int random = Utility.Random(pickables.Count); if (random >= pickables.Count) { random = 0; } Item itemToPick = pickables[random]; if (pickables[random].Amount > 1 && from.AddToBackpack(itemToPick)) { itemToPick.Amount = 1; pickables[random].Amount--; } else { if (from.AddToBackpack(itemToPick)) { pack.OnItemRemoved(pickables[random]); } } } } else if (rating == SuccessRating.Failure) { from.SendMessage("You fail."); } else if (rating == SuccessRating.HazzardousFailure || rating == SuccessRating.CriticalFailure) { from.SendMessage("You fail utterly."); } else if (rating == SuccessRating.TooDifficult) { from.SendMessage("You do not have the necessary lokaiSkill to attempt this."); } double caughtChance = 1.0; switch (rating) { case SuccessRating.CriticalFailure: caughtChance = 0.95; break; case SuccessRating.HazzardousFailure: caughtChance = 0.8; break; case SuccessRating.Failure: caughtChance = 0.65; break; case SuccessRating.PartialSuccess: caughtChance = 0.5; break; case SuccessRating.Success: caughtChance = 0.3; break; case SuccessRating.CompleteSuccess: caughtChance = 0.1; break; case SuccessRating.ExceptionalSuccess: caughtChance = 0.05; break; case SuccessRating.TooEasy: caughtChance = -0.01; break; default: break; } return(caughtChance < Utility.RandomDouble()); }
public override void OnDoubleClick(Mobile from) { if (m_sower == null || m_sower.Deleted) { m_sower = from; } if (from.Mounted && !CropHelper.CanWorkMounted) { from.SendMessage("You cannot harvest a crop while mounted."); return; } if (DateTime.Now > lastpicked.AddSeconds(3)) // 3 seconds between picking { lastpicked = DateTime.Now; int mageValue = (int)from.Skills[SkillName.Magery].Value / 20; //FUTURE add two skill checks... if (mageValue == 0) { from.SendMessage("You have no idea how to harvest this crop."); return; } if (from.InRange(this.GetWorldLocation(), 1)) { if (m_yield < 1) { from.SendMessage("There is nothing here to harvest."); if (PlayerCanDestroy && !(m_sower.AccessLevel > AccessLevel.Counselor)) { UpRootGump g = new UpRootGump(from, this); from.SendGump(g); } } else //check skill and sower { from.Direction = from.GetDirectionTo(this); from.Animate(from.Mounted ? 29:32, 5, 1, true, false, 0); if (from == m_sower) { mageValue *= 2; m_lastvisit = DateTime.Now; } if (mageValue > m_yield) { mageValue = m_yield + 1; } int pick = Utility.Random(mageValue); if (pick == 0) { from.SendMessage("You do not manage to harvest any crops."); return; } m_yield -= pick; from.SendMessage("You harvest {0} crop{1}!", pick, (pick == 1 ? "" : "s")); //PublicOverheadMessage( MessageType.Regular, 0x3BD, false, string.Format( "{0}", m_yield )); ((Item)this).ItemID = pickedGraphic; Turnip crop = new Turnip(pick); from.AddToBackpack(crop); if (SowerPickTime != TimeSpan.Zero && m_lastvisit + SowerPickTime < DateTime.Now && !(m_sower.AccessLevel > AccessLevel.Counselor)) { this.UpRoot(from); return; } if (!regrowTimer.Running) { regrowTimer.Start(); } } } else { from.SendMessage("You are too far away to harvest anything."); } } }
public static void LiveFreeze(Mobile from, Map targetMap, Point3D start3d, Point3D end3d) { Dictionary<Point2D, List<Item>> ItemsByBlockLocation = new Dictionary<Point2D, List<Item>>(); if (targetMap != null && start3d != NullP3D && end3d != NullP3D) { Point2D start = targetMap.Bound(new Point2D(start3d)); Point2D end = targetMap.Bound(new Point2D(end3d)); IPooledEnumerable eable = targetMap.GetItemsInBounds(new Rectangle2D(start.X, start.Y, end.X - start.X + 1, end.Y - start.Y + 1)); Console.WriteLine(string.Format("Invoking live freeze from {0},{1} to {2},{3}", start.X, start.Y, end.X, end.Y)); foreach (Item item in eable) { if (item is Static || item is BaseFloor || item is BaseWall) { Map itemMap = item.Map; if (itemMap == null || itemMap == Map.Internal) continue; Point2D p = new Point2D(item.X >> 3, item.Y >> 3); if (!(ItemsByBlockLocation.ContainsKey(p))) { ItemsByBlockLocation.Add(p, new List<Item>()); } ItemsByBlockLocation[p].Add(item); } } eable.Free(); } else { from.SendMessage("That was not a proper area. Please retarget and reissue the command."); return; } TileMatrix matrix = targetMap.Tiles; foreach (KeyValuePair<Point2D, List<Item>> kvp in ItemsByBlockLocation) { StaticTile[][][] blockOfTiles = matrix.GetStaticBlock(kvp.Key.X, kvp.Key.Y); Dictionary<Point2D, List<StaticTile>> newBlockStatics = new Dictionary<Point2D, List<StaticTile>>(); foreach (Item item in kvp.Value) { int xOffset = item.X - (kvp.Key.X * 8); int yOffset = item.Y - (kvp.Key.Y * 8); if (xOffset < 0 || xOffset >= 8 || yOffset < 0 || yOffset >= 8) continue; StaticTile newTile = new StaticTile((ushort)item.ItemID, (byte)xOffset, (byte)yOffset, (sbyte)item.Z, (short)item.Hue); Point2D refPoint = new Point2D(xOffset, yOffset); if (!(newBlockStatics.ContainsKey(refPoint))) { newBlockStatics.Add(refPoint, new List<StaticTile>()); } newBlockStatics[refPoint].Add(newTile); item.Delete(); } for (int i = 0; i < blockOfTiles.Length; i++) for (int j = 0; j < blockOfTiles[i].Length; j++) for (int k = 0; k < blockOfTiles[i][j].Length; k++) { Point2D refPoint = new Point2D(i, j); if (!(newBlockStatics.ContainsKey(refPoint))) { newBlockStatics.Add(refPoint, new List<StaticTile>()); } newBlockStatics[refPoint].Add(blockOfTiles[i][j][k]); } StaticTile[][][] newblockOfTiles = new StaticTile[8][][]; for (int i = 0; i < 8; i++) { newblockOfTiles[i] = new StaticTile[8][]; for (int j = 0; j < 8; j++) { Point2D p = new Point2D(i, j); int length = 0; if (newBlockStatics.ContainsKey(p)) { length = newBlockStatics[p].Count; } newblockOfTiles[i][j] = new StaticTile[length]; for (int k = 0; k < length; k++) { if (newBlockStatics.ContainsKey(p)) { newblockOfTiles[i][j][k] = newBlockStatics[p][k]; } } } } matrix.SetStaticBlock(kvp.Key.X, kvp.Key.Y, newblockOfTiles); int blockNum = ((kvp.Key.X * matrix.BlockHeight) + kvp.Key.Y); List<Mobile> candidates = new List<Mobile>(); int bX = kvp.Key.X * 8; int bY = kvp.Key.Y * 8; IPooledEnumerable eable = targetMap.GetMobilesInRange(new Point3D(bX, bY, 0)); foreach (Mobile m in eable) { if (m.Player) { candidates.Add(m); } } eable.Free(); CRC.InvalidateBlockCRC(targetMap.MapID, blockNum); foreach (Mobile m in candidates) { m.Send(new UpdateStaticsPacket(new Point2D(kvp.Key.X, kvp.Key.Y), m)); } MapChangeTracker.MarkStaticsBlockForSave(targetMap.MapID, kvp.Key); } }
private static void SayRandom(string[] say, Mobile m) { m.SendMessage(say[Utility.Random(say.Length)]); }
public void OnTarget(Mobile from, object targeted, BaseCommand command, string[] args) { if (!BaseCommand.IsAccessible(from, targeted)) { from.SendLocalizedMessage(500447); // That is not accessible. from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, (m, t, a) => OnTarget(m, t, command, a), args ); return; } switch (command.ObjectTypes) { case ObjectTypes.Both: { if (!(targeted is Item or Mobile)) { from.SendMessage("This command does not work on that."); return; } break; } case ObjectTypes.Items: { if (targeted is not Item) { from.SendMessage("This command only works on items."); return; } break; } case ObjectTypes.Mobiles: { if (targeted is not Mobile) { from.SendMessage("This command only works on mobiles."); return; } break; } } RunCommand(from, targeted, command, args); from.BeginTarget( -1, command.ObjectTypes == ObjectTypes.All, TargetFlags.None, (m, t, a) => OnTarget(m, t, command, a), args ); }