ModernUO/Scripts/Skills/Begging.cs
xavier 5c7774b99a Missing System Message "Your pet looks happier" (regardless of loyalty)
http://www.runuo.com/community/threads/ready-missing-system-message-your-pet-looks-happier.450209/

Not all powerscrolls do drop - Ninjitsu, Bushido etc.
http://www.runuo.com/community/threads/ready-not-all-powerscrolls-do-drop.459974/

Savage Kin Paint Wrong Skill Requirement + Wrong Success Chance
http://www.runuo.com/community/threads/ready-savage-kin-paint-wrong-skill-requirement-wrong-success-chance.455360/

Hag Quest - Stew, can't eat it
http://www.runuo.com/community/threads/ready-hag-quest-stew.454406/

Giant Blue Beetles shouldn't need beating into submission after being tamed once
http://www.runuo.com/community/threads/ready-giant-blue-beetles.450205/

Greater Dragon Fame/Karma Doesn't Match OSI
http://www.runuo.com/community/threads/ready-greater-dragon-fame-karma-doesnt-match-osi.472206/

Resizing Houses, you can resize a house by using a command under the house sign
http://www.runuo.com/community/threads/ready-resizing-houses.414762/

Crafted Shield Resists are wrong on RunUO
http://www.runuo.com/community/threads/ready-crafted-shield-resists.454186/

Yomotsu Mines, you should not be able to recall out of there.
http://www.runuo.com/community/threads/ready-yomotsu-mines.445486/

Missing Necro Icons in the Buff/Debuff Bar
http://www.runuo.com/community/threads/ready-missing-necro-icons-in-the-buff-debuff-bar.450872/

Chivalry Spells, you are allowed to attempt casting of spells outside of your skill range without a system message
http://www.runuo.com/community/threads/ready-chivalry-spells.450757/

Tinker tools use a different graphic on OSI
http://www.runuo.com/community/threads/ready-tinker-tools.460690/

Tinkering should not be required when crafted a Tetsubo
http://www.runuo.com/community/threads/ready-wrong-skill-requirement-carpentry-wrong-success-chances.455342/

Carpentry-Small+Large Beds -Wrong Success Chance
http://www.runuo.com/community/threads/ready-carpentry-small-large-beds-wrong-success-chance.455794/

Telekinesis, various changes to behaviour with items
http://www.runuo.com/community/threads/ready-telekinesis.455250/

Forensic Evaluation Various issues
http://www.runuo.com/community/threads/ready-forensic-evaluation-various-issues-merged.458700/

Animate Dead Corpses, you cannot carve the corpse after it's used
http://www.runuo.com/community/threads/ready-animate-dead-corpses.453823/

You should be able to use begging skill while riding
http://www.runuo.com/community/threads/ready-begging-while-riding.466174/

Crafting Mod Lower Requirements should only appear on shields
http://www.runuo.com/community/threads/ready-crafting-mod-lower-requirements.452112/

You should be revealed While Taking Poison/Strangle Damage
http://www.runuo.com/community/threads/ready-you-never-reveal-while-taking-poison-strangle-damage.456946/

Insurance messages don't do the math!
http://www.runuo.com/community/threads/ready-insurance-messages-dont-do-the-math.454928/

Slayers should work on area of effect spells
http://www.runuo.com/community/threads/ready-slayers-should-work-on-area-of-effect-spells.448774/

You should not be able to use any travel spell in Heartwood
http://www.runuo.com/community/threads/ready-heartwood.457379/

Welcome Back To The House Friend message does not show post-AoS
http://www.runuo.com/community/threads/ready-welcome-back-to-the-house-friend.415924/

Giant Beetle speed should be very fast when magery spells are cast on it
http://www.runuo.com/community/threads/ready-giant-beetle.417848/
2011-06-25 18:39:14 +00:00

175 lines
No EOL
4.6 KiB
C#

using System;
using Server;
using Server.Misc;
using Server.Targeting;
using Server.Items;
using Server.Network;
namespace Server.SkillHandlers
{
public class Begging
{
public static void Initialize()
{
SkillInfo.Table[(int)SkillName.Begging].Callback = new SkillUseCallback( OnUse );
}
public static TimeSpan OnUse( Mobile m )
{
m.RevealingAction();
m.Target = new InternalTarget();
m.RevealingAction();
m.SendLocalizedMessage( 500397 ); // To whom do you wish to grovel?
return TimeSpan.FromHours( 6.0 );
}
private class InternalTarget : Target
{
private bool m_SetSkillTime = true;
public InternalTarget() : base ( 12, false, TargetFlags.None )
{
}
protected override void OnTargetFinish( Mobile from )
{
if ( m_SetSkillTime )
from.NextSkillTime = DateTime.Now;
}
protected override void OnTarget( Mobile from, object targeted )
{
from.RevealingAction();
int number = -1;
if ( targeted is Mobile )
{
Mobile targ = (Mobile)targeted;
if ( targ.Player ) // We can't beg from players
{
number = 500398; // Perhaps just asking would work better.
}
else if ( !targ.Body.IsHuman ) // Make sure the NPC is human
{
number = 500399; // There is little chance of getting money from that!
}
else if ( !from.InRange( targ, 2 ) )
{
if ( !targ.Female )
number = 500401; // You are too far away to beg from him.
else
number = 500402; // You are too far away to beg from her.
}
else if (!( Core.ML ) && from.Mounted ) // If we're on a mount, who would give us money? TODO: guessed it's removed since ML
{
number = 500404; // They seem unwilling to give you any money.
}
else
{
// Face eachother
from.Direction = from.GetDirectionTo( targ );
targ.Direction = targ.GetDirectionTo( from );
from.Animate( 32, 5, 1, true, false, 0 ); // Bow
new InternalTimer( from, targ ).Start();
m_SetSkillTime = false;
}
}
else // Not a Mobile
{
number = 500399; // There is little chance of getting money from that!
}
if ( number != -1 )
from.SendLocalizedMessage( number );
}
private class InternalTimer : Timer
{
private Mobile m_From, m_Target;
public InternalTimer( Mobile from, Mobile target ) : base( TimeSpan.FromSeconds( 2.0 ) )
{
m_From = from;
m_Target = target;
Priority = TimerPriority.TwoFiftyMS;
}
protected override void OnTick()
{
Container theirPack = m_Target.Backpack;
double badKarmaChance = 0.5 - ((double)m_From.Karma / 8570);
if ( theirPack == null )
{
m_From.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money.
}
else if ( m_From.Karma < 0 && badKarmaChance > Utility.RandomDouble() )
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500406 ); // Thou dost not look trustworthy... no gold for thee today!
}
else if ( m_From.CheckTargetSkill( SkillName.Begging, m_Target, 0.0, 100.0 ) )
{
int toConsume = theirPack.GetAmount( typeof( Gold ) ) / 10;
int max = 10 + (m_From.Fame / 2500);
if ( max > 14 )
max = 14;
else if ( max < 10 )
max = 10;
if ( toConsume > max )
toConsume = max;
if ( toConsume > 0 )
{
int consumed = theirPack.ConsumeUpTo( typeof( Gold ), toConsume );
if ( consumed > 0 )
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500405 ); // I feel sorry for thee...
Gold gold = new Gold( consumed );
m_From.AddToBackpack( gold );
m_From.PlaySound( gold.GetDropSound() );
if ( m_From.Karma > -3000 )
{
int toLose = m_From.Karma + 3000;
if ( toLose > 40 )
toLose = 40;
Titles.AwardKarma( m_From, -toLose, true );
}
}
else
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any!
}
}
else
{
m_Target.PublicOverheadMessage( MessageType.Regular, m_Target.SpeechHue, 500407 ); // I have not enough money to give thee any!
}
}
else
{
m_Target.SendLocalizedMessage( 500404 ); // They seem unwilling to give you any money.
}
m_From.NextSkillTime = DateTime.Now + TimeSpan.FromSeconds( 10.0 );
}
}
}
}
}