本文整理汇总了C#中Server.Skill类的典型用法代码示例。如果您正苦于以下问题:C# Skill类的具体用法?C# Skill怎么用?C# Skill使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Skill类属于Server命名空间,在下文中一共展示了Skill类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ForceSkillGain
public static bool ForceSkillGain( Mobile from, Skill skill )
{
if ( from.Player )
{
MobileRateInfo mobileInfo = MobileRateInfo.GetMobileInfo( from );
SkillRateInfo skillInfo = mobileInfo.GetSkillInfo( skill );
int[] table = null;
if ( from.Skills.Total <= 350 )
table = m_Terms350;
else if ( from.Skills.Total <= 500 )
table = m_Terms500;
else
table = m_Terms700;
int index = skill.BaseFixedPoint / 50;
if ( DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes( table[ index > 23 ? 23 : index ] ) )
return false;
return true;
}
return false;
}
示例2: SkillGainAllowed
public static bool SkillGainAllowed( Mobile from, Skill skill )
{
if ( from.Player )
{
MobileRateInfo mobileInfo = MobileRateInfo.GetMobileInfo( from );
SkillRateInfo skillInfo = mobileInfo.GetSkillInfo( skill );
// SKILL GAIN RESTRICTIONS
// Here you can edit restrictions suitable for your needs
if ( skill.Base >= 100.0 && ( mobileInfo.SkillGainsCount >= 72 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes( 5.0 ) ) )
return false;
if ( skill.Base >= 90.0 && ( mobileInfo.SkillGainsCount >= 30 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes( 10.0 ) ) )
return false;
else if ( skill.Base >= 80.0 && ( mobileInfo.SkillGainsCount >= 60 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes( 5.0 ) ) )
return false;
else if ( skill.Base >= 70.0 && ( mobileInfo.SkillGainsCount >= 100 || DateTime.Now - skillInfo.LastGainTime < TimeSpan.FromMinutes( 3.0 ) ) )
return false;
else if ( skill.Base < 70.0 )
return true;
// End!
mobileInfo.SkillGainsCount++;
skillInfo.LastGainTime = DateTime.Now;
skillInfo.GainsCount++;
}
return true;
}
示例3: RegisterSkillGain
public static void RegisterSkillGain( Mobile from, Skill skill )
{
if ( from.Player )
{
MobileRateInfo mobileInfo = MobileRateInfo.GetMobileInfo( from );
SkillRateInfo skillInfo = mobileInfo.GetSkillInfo( skill );
skillInfo.LastGainTime = DateTime.Now;
}
}
示例4: Insert
public bool Insert(Skill skill)
{
try
{
_ctx.Skills.Add(skill);
return true;
}
catch
{
return false;
}
}
示例5: Delete
public bool Delete(Skill skill)
{
try
{
_ctx.Skills.Remove(skill);
return true;
}
catch
{
return false;
}
}
示例6: Update
public bool Update(Skill oldSkill, Skill newSkill)
{
try
{
_ctx.Entry(oldSkill).CurrentValues.SetValues(newSkill);
return true;
}
catch
{
return false;
}
}
示例7: CheckSkillUse
// determines whether XmlSpawner, XmlAttachment, or XmlQuest OnSkillUse methods should be invoked.
public static void CheckSkillUse( Mobile m, Skill skill, bool success)
{
if(!(m is PlayerMobile) || skill == null) return;
/*
// first check for any attachments that might support OnSkillUse
ArrayList list = XmlAttach.FindAttachments(m);
if(list != null && list.Count > 0)
{
foreach(XmlAttachment a in list)
{
if(a != null && !a.Deleted && a.HandlesOnSkillUse)
{
a.OnSkillUse(m, skill, success);
}
}
}
*/
// then check for registered skills
ArrayList skilllist = RegisteredSkill.TriggerList(skill.SkillName, m.Map);
if(skilllist == null) return;
// determine whether there are any registered objects for this skill
foreach(RegisteredSkill rs in skilllist)
{
if(rs.sid == skill.SkillName)
{
// if so then invoke their skill handlers
if(rs.target is XmlSpawner)
{
XmlSpawner spawner = (XmlSpawner)rs.target;
if ( spawner.HandlesOnSkillUse )
{
// call the spawner handler
spawner.OnSkillUse(m, skill, success);
}
} else
if(rs.target is IXmlQuest)
{
IXmlQuest quest = (IXmlQuest)rs.target;
if ( quest.HandlesOnSkillUse )
{
// call the xmlquest handler
quest.OnSkillUse(m, skill, success);
}
}
}
}
}
示例8: EditSkillGump
public EditSkillGump( Mobile from, Mobile target, Skill skill, SkillsGumpGroup selected )
: base(GumpOffsetX, GumpOffsetY)
{
m_From = from;
m_Target = target;
m_Skill = skill;
m_Selected = selected;
string initialText = m_Skill.Base.ToString( "F1" );
AddPage( 0 );
AddBackground( 0, 0, BackWidth, BackHeight, BackGumpID );
AddImageTiled( BorderSize, BorderSize, TotalWidth - ( OldStyle ? SetWidth + OffsetSize : 0 ), TotalHeight, OffsetGumpID );
int x = BorderSize + OffsetSize;
int y = BorderSize + OffsetSize;
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddLabelCropped( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, skill.Name );
x += EntryWidth + OffsetSize;
if ( SetGumpID != 0 )
{
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
}
x = BorderSize + OffsetSize;
y += EntryHeight + OffsetSize;
AddImageTiled( x, y, EntryWidth, EntryHeight, EntryGumpID );
AddTextEntry( x + TextOffsetX, y, EntryWidth - TextOffsetX, EntryHeight, TextHue, 0, initialText );
x += EntryWidth + OffsetSize;
if ( SetGumpID != 0 )
{
AddImageTiled( x, y, SetWidth, EntryHeight, SetGumpID );
}
AddButton( x + SetOffsetX, y + SetOffsetY, SetButtonID1, SetButtonID2, 1, GumpButtonType.Reply, 0 );
}
示例9: eSkillTrabalho
public static bool eSkillTrabalho(Skill skill)
{
SkillName nomeSkill = skill.SkillName;
//Skills de trabalho
if(nomeSkill == SkillName.Alchemy
|| nomeSkill == SkillName.Blacksmith
|| nomeSkill == SkillName.Fletching
|| nomeSkill == SkillName.Carpentry
|| nomeSkill == SkillName.Cartography
|| nomeSkill == SkillName.Cooking
|| nomeSkill == SkillName.Fishing
|| nomeSkill == SkillName.Tailoring
|| nomeSkill == SkillName.Tinkering
|| nomeSkill == SkillName.Lumberjacking
|| nomeSkill == SkillName.Mining) {
return true;
}
return false;
}
示例10: IsRaceBonus
private bool IsRaceBonus( Mobile m, Skill skill ) {
PlayerMobile pm = m as PlayerMobile;
if( pm.Skills[skill.SkillID].Cap > 100.0 )
return true;
return false;
}
示例11: CheckSkill
public static bool CheckSkill( Mobile from, Skill skill, object amObj, double chance )
{
if ( from.Skills.Cap == 0 )
return false;
bool success = ( chance >= Utility.RandomDouble() );
double gc = (double)(from.Skills.Cap - from.Skills.Total) / from.Skills.Cap;
gc += ( skill.Cap - skill.Base ) / skill.Cap;
gc /= 5;
gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );
gc /= 5;
gc *= skill.Info.GainFactor;
if ( gc < 0.001 )
gc = 0.001;
if ( from is BaseCreature && ((BaseCreature)from).Controlled )
gc *= 2;
if ( from.Alive && ( ( gc >= Utility.RandomDouble() && AllowGain( from, skill, amObj ) ) || skill.Base < 10.0 ) )
Gain( from, skill );
// GGS start
else if ( chance <= 0.99 && chance >= 0.1 && skill.Base < skill.Cap && skill.Lock == SkillLock.Up )
{
if ( from.SkillsTotal >= from.SkillsCap )
{
for ( int i = 0; i < from.Skills.Length; ++i )
{
Skill sk = from.Skills[i];
if ( sk.Base == 0 || sk.Lock != SkillLock.Down )
continue;
Gain_GGS( from, skill );
}
}
else
Gain_GGS( from, skill );
}
// GGS end
return success;
}
示例12: AntiMacroCheck
public bool AntiMacroCheck(Skill skill, object obj)
{
if (obj == null || m_AntiMacroTable == null || this.AccessLevel != AccessLevel.Player)
return true;
Hashtable tbl = (Hashtable)m_AntiMacroTable[skill];
if (tbl == null)
m_AntiMacroTable[skill] = tbl = new Hashtable();
CountAndTimeStamp count = (CountAndTimeStamp)tbl[obj];
if (count != null)
{
if (count.TimeStamp + SkillCheck.AntiMacroExpire <= DateTime.Now)
{
count.Count = 1;
return true;
}
else
{
++count.Count;
if (count.Count <= SkillCheck.Allowance)
return true;
else
return false;
}
}
else
{
tbl[obj] = count = new CountAndTimeStamp();
count.Count = 1;
return true;
}
}
示例13: OnSkillInvalidated
public override void OnSkillInvalidated(Skill skill)
{
if (Core.AOS && skill.SkillName == SkillName.MagicResist)
UpdateResistances();
}
示例14: AllowGain
private static bool AllowGain( Mobile from, Skill skill, object obj )
{
if ( Core.AOS && Faction.InSkillLoss( from ) ) //Changed some time between the introduction of AoS and SE.
return false;
if ( AntiMacroCode && from is PlayerMobile && UseAntiMacro[skill.Info.SkillID] )
return ((PlayerMobile)from).AntiMacroCheck( skill, obj );
else
return true;
}
示例15: OnSkillChange
public void OnSkillChange( Skill skill )
{
if ( skill == m_Highest ) // could be downgrading the skill, force a recalc
m_Highest = null;
else if ( m_Highest != null && skill.BaseFixedPoint > m_Highest.BaseFixedPoint )
m_Highest = skill;
m_Owner.OnSkillInvalidated( skill );
NetState ns = m_Owner.NetState;
if ( ns != null )
ns.Send( new SkillChange( skill ) );
}