本文整理汇总了C#中VirtueName类的典型用法代码示例。如果您正苦于以下问题:C# VirtueName类的具体用法?C# VirtueName怎么用?C# VirtueName使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
VirtueName类属于命名空间,在下文中一共展示了VirtueName类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Atrophy
public static bool Atrophy( Mobile from, VirtueName virtue )
{
int current = from.Virtues.GetValue( (int)virtue );
if ( current > 0 )
from.Virtues.SetValue( (int)virtue, current - 1 );
return ( current > 0 );
}
示例2: GetMaxAmount
public static int GetMaxAmount(VirtueName virtue)
{
if (virtue == VirtueName.Honor)
return 20000;
if (virtue == VirtueName.Sacrifice)
return 22000;
return 21000;
}
示例3: GetLevel
public static VirtueLevel GetLevel( Mobile from, VirtueName virtue )
{
int v = from.Virtues.GetValue( (int) virtue ) / 10;
if ( v < 0 )
v = 0;
else if ( v > 3 )
v = 3;
return (VirtueLevel)v;
}
示例4: Atrophy
public static bool Atrophy( Mobile from, VirtueName virtue, int amount )
{
int current = from.Virtues.GetValue( (int)virtue );
if( (current - amount) >= 0 )
from.Virtues.SetValue( (int)virtue, current - amount );
else
from.Virtues.SetValue( (int)virtue, 0 );
return ( current > 0 );
}
示例5: GetMaxAmount
public static int GetMaxAmount( VirtueName virtue )
{
//Edit by Silver
return 30000;
//if( virtue == VirtueName.Honor )
// return 20000;
//if( virtue == VirtueName.Sacrifice )
// return 22000;
//return 21000;
}
示例6: GetLevel
public static VirtueLevel GetLevel( Mobile from, VirtueName virtue )
{
int v = from.Virtues.GetValue( (int)virtue );
int vl;
if ( v < 4000 )
vl = 0;
else if ( v >= 20000 )
vl = 3;
else
vl = ( v + 9999 ) / 10000;
return (VirtueLevel)vl;
}
示例7: Award
public static bool Award( Mobile from, VirtueName virtue, int amount, ref bool gainedPath )
{
int current = from.Virtues.GetValue( (int)virtue );
if ( current >= 40 )
return false;
if ( (current + amount) >= 40 )
amount = 40 - current;
VirtueLevel oldLevel = GetLevel( from, virtue );
from.Virtues.SetValue( (int)virtue, current + amount );
gainedPath = ( GetLevel( from, virtue ) != oldLevel );
return true;
}
示例8: AwardVirtue
public static void AwardVirtue( PlayerMobile pm, VirtueName virtue, int amount )
{
if ( virtue == VirtueName.Compassion )
{
if ( pm.CompassionGains > 0 && DateTime.Now > pm.NextCompassionDay )
{
pm.NextCompassionDay = DateTime.MinValue;
pm.CompassionGains = 0;
}
if ( pm.CompassionGains >= 5 )
{
pm.SendLocalizedMessage( 1053004 ); // You must wait about a day before you can gain in compassion again.
return;
}
}
bool gainedPath = false;
string virtueName = Enum.GetName( typeof( VirtueName ), virtue );
if ( VirtueHelper.Award( pm, virtue, amount, ref gainedPath ) )
{
// TODO: Localize?
if ( gainedPath )
pm.SendMessage( "You have gained a path in {0}!", virtueName );
else
pm.SendMessage( "You have gained in {0}.", virtueName );
if ( virtue == VirtueName.Compassion )
{
pm.NextCompassionDay = DateTime.Now + TimeSpan.FromDays( 1.0 );
++pm.CompassionGains;
if ( pm.CompassionGains >= 5 )
pm.SendLocalizedMessage( 1053004 ); // You must wait about a day before you can gain in compassion again.
}
}
else
{
// TODO: Localize?
pm.SendMessage( "You have achieved the highest path of {0} and can no longer gain any further.", virtueName );
}
}
示例9: IsHighestPath
public static bool IsHighestPath( Mobile from, VirtueName virtue )
{
return ( from.Virtues.GetValue( (int)virtue ) >= 40 );
}
示例10: HasAny
public static bool HasAny( Mobile from, VirtueName virtue )
{
return ( from.Virtues.GetValue( (int)virtue ) > 0 );
}
示例11: Atrophy
public static bool Atrophy(Mobile from, VirtueName virtue)
{
return Atrophy(from, virtue, 1);
}
示例12: VirtueBonusEntry
public VirtueBonusEntry( VirtueName virtue, string mantra, Rectangle2D location, int cliloc )
{
Virtue = virtue;
Mantra = mantra;
Area = location;
Cliloc = cliloc;
}
示例13: VirtueInfoGump
public VirtueInfoGump(Mobile beholder, VirtueName virtue, int description, string webPage)
: base(0, 0)
{
this.m_Beholder = beholder;
this.m_Virtue = virtue;
this.m_Desc = description;
this.m_Page = webPage;
int value = beholder.Virtues.GetValue((int)virtue);
this.AddPage(0);
this.AddImage(30, 40, 2080);
this.AddImage(47, 77, 2081);
this.AddImage(47, 147, 2081);
this.AddImage(47, 217, 2081);
this.AddImage(47, 267, 2083);
this.AddImage(70, 213, 2091);
this.AddPage(1);
int maxValue = VirtueHelper.GetMaxAmount(this.m_Virtue);
int valueDesc;
int dots;
if (value < 4000)
dots = value / 400;
else if (value < 10000)
dots = (value - 4000) / 600;
else if (value < maxValue)
dots = (value - 10000) / ((maxValue - 10000) / 10);
else
dots = 10;
for (int i = 0; i < 10; ++i)
this.AddImage(95 + (i * 17), 50, i < dots ? 2362 : 2360);
if (value < 1)
valueDesc = 1052044; // You have not started on the path of this Virtue.
else if (value < 400)
valueDesc = 1052045; // You have barely begun your journey through the path of this Virtue.
else if (value < 2000)
valueDesc = 1052046; // You have progressed in this Virtue, but still have much to do.
else if (value < 3600)
valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
else if (value < 4000)
valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
else if (dots < 1)
valueDesc = 1052049; // You have achieved a path in this Virtue.
else if (dots < 9)
valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
else if (dots < 10)
valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
else
valueDesc = 1052050; // You have achieved the highest path in this Virtue.
this.AddHtmlLocalized(157, 73, 200, 40, 1051000 + (int)virtue, false, false);
this.AddHtmlLocalized(75, 95, 220, 140, description, false, false);
this.AddHtmlLocalized(70, 224, 229, 60, valueDesc, false, false);
this.AddButton(65, 277, 1209, 1209, 1, GumpButtonType.Reply, 0);
this.AddButton(280, 43, 4014, 4014, 2, GumpButtonType.Reply, 0);
this.AddHtmlLocalized(83, 275, 400, 40, (webPage == null) ? 1052055 : 1052052, false, false); // This virtue is not yet defined. OR -click to learn more (opens webpage)
}
示例14: VirtueInfoGump
public VirtueInfoGump( Mobile beholder, VirtueName virtue, int description )
: base(0, 0)
{
m_Beholder = beholder;
m_Virtue = virtue;
m_Desc = description;
int value = beholder.Virtues.GetValue( (int) virtue );
AddPage( 0 );
AddImage( 30, 40, 2080 );
AddImage( 47, 77, 2081 );
AddImage( 47, 147, 2081 );
AddImage( 47, 217, 2081 );
AddImage( 47, 267, 2083 );
AddImage( 70, 213, 2091 );
AddPage( 1 );
int maxValue = VirtueHelper.GetMaxAmount( m_Virtue );
int valueDesc;
if ( value < 1 )
valueDesc = 1052044; // You have not started on the path of this Virtue.
else if ( value < maxValue / 6 )
valueDesc = 1052045; // You have barely begun your journey through the path of this Virtue.
else if ( value < maxValue / 3 )
valueDesc = 1052046; // You have progressed in this Virtue, but still have much to do.
else if ( value < maxValue / 2 )
valueDesc = 1052047; // Your journey through the path of this Virtue is going well.
else if ( value < 2 * maxValue / 3 )
valueDesc = 1052048; // You feel very close to achieving your next path in this Virtue.
else if ( value < 5 * maxValue / 6 )
valueDesc = 1052049; // You have achieved a path in this Virtue.
else
valueDesc = 1052050; // You have achieved the highest path in this Virtue.
AddHtmlLocalized( 157, 73, 200, 40, 1051000 + (int) virtue, false, false );
AddHtmlLocalized( 75, 95, 220, 140, description, false, false );
AddHtmlLocalized( 70, 224, 229, 60, valueDesc, false, false );
AddButton( 65, 277, 1209, 1209, 1, GumpButtonType.Reply, 0 );
AddButton( 280, 43, 4014, 4014, 2, GumpButtonType.Reply, 0 );
AddHtmlLocalized( 83, 275, 400, 40, 1052055, false, false ); // This virtue is not yet defined.
AddKRHtmlLocalized( 0, 0, 0, 0, 1078056, false, false ); // MORE
AddKRHtmlLocalized( 0, 0, 0, 0, 1011447, false, false ); // BACK
AddKRHtmlLocalized( 0, 0, 0, 0, 1078055, false, false ); // USE
AddKRHtmlLocalized( 0, 0, 0, 0, 0, false, false );
int dots;
if ( value < 4000 )
dots = value / 400;
else if ( value < 10000 )
dots = ( value - 4000 ) / 600;
else if ( value < maxValue )
dots = ( value - 10000 ) / ( ( maxValue - 10000 ) / 10 );
else
dots = 10;
for ( int i = 0; i < 10; ++i )
AddImage( 95 + ( i * 17 ), 50, i < dots ? 2362 : 2360 );
}
示例15: IsKnight
public static bool IsKnight( Mobile from, VirtueName virtue )
{
return ( GetLevel( from, virtue ) >= VirtueLevel.Knight );
}