Strange runtime problem when logging in
Hello,
I'm running my server on ubuntu 8.04 right now. Basically everything is working but i changed now my system because i was pissed of uploading all *.cs files to the server.
So i thought: OK! i compile the hole server in 1 exe file and put it on the server and run it.
I compiled all scripts (Server & Scripts) and ran it... So far no problem. But when i try to logon my server or any mobile checks a skill the %@&%§$ throws this error: (look Error)
The funny thing is: The problem is probably caused by SkillCheck.cs compiled into my new serverfile. But i didn't change ANYTHING in this file and on the real server (with the old compilingsystem) this file is equal to mine... (I'm 100% sure)
Error: (no crashlog from runuo... just the terminal throws this error... i ran it in mono --debug *.exe to get more information)
Is this a Mono bug? Or any suggestions?
thx
Hurraa
Hello,
I'm running my server on ubuntu 8.04 right now. Basically everything is working but i changed now my system because i was pissed of uploading all *.cs files to the server.
So i thought: OK! i compile the hole server in 1 exe file and put it on the server and run it.
I compiled all scripts (Server & Scripts) and ran it... So far no problem. But when i try to logon my server or any mobile checks a skill the %@&%§$ throws this error: (look Error)
The funny thing is: The problem is probably caused by SkillCheck.cs compiled into my new serverfile. But i didn't change ANYTHING in this file and on the real server (with the old compilingsystem) this file is equal to mine... (I'm 100% sure)
Error: (no crashlog from runuo... just the terminal throws this error... i ran it in mono --debug *.exe to get more information)
Code:
** ERROR **: generic_params table claims method has generic parameters, but signature says it doesn't
aborting...
Stacktrace:
at Server.Misc.SkillCheck.Mobile_SkillCheckDirectLocation (Server.Mobile,Server.SkillName,double) <0xffffffff>
at Server.Misc.SkillCheck.Mobile_SkillCheckDirectLocation (Server.Mobile,Server.SkillName,double) <0x00151>
at (wrapper delegate-invoke) System.MulticastDelegate.invoke_bool_Mobile_SkillName_double (Server.Mobile,Server.SkillName,double) <0xffffffff>
at Server.Mobile.CheckSkill (Server.SkillName,double) <0x00029>
at Server.Misc.RegenRates.CheckBonusSkill (Server.Mobile,int,int,Server.SkillName) <0x000ab>
at Server.Misc.RegenRates.Mobile_StamRegenRate (Server.Mobile) <0x00081>
at (wrapper delegate-invoke) System.MulticastDelegate.invoke_TimeSpan_Mobile (Server.Mobile) <0xffffffff>
at Server.Mobile.GetStamRegenRate (Server.Mobile) <0x00034>
at StamTimer..ctor (Server.Mobile) <0x00017>
at Server.Mobile.CheckStatTimers () <0x0010f>
at Server.Mobile.set_Player (bool) <0x00062>
at Server.Misc.CharacterCreation.EventSink_CharacterCreated (Server.CharacterCreatedEventArgs) <0x00098>
at Server.EventSink.InvokeCharacterCreated (Server.CharacterCreatedEventArgs) <0x00019>
at Server.Network.PacketHandlers.CreateCharacter (Server.Network.NetState,Server.Network.PacketReader) <0x005a1>
at Server.Network.MessagePump.HandleReceive (Server.Network.NetState) <0x00587>
at Server.Network.MessagePump.Slice () <0x0008a>
at Server.Core.Main (string[]) <0x00765>
at (wrapper runtime-invoke) Server.Core.runtime_invoke_void_string[] (object,intptr,intptr,intptr) <0xffffffff>
Native stacktrace:
mono [0x816b1fa]
[0xb7f96440]
/lib/tls/i686/cmov/libc.so.6(abort+0x101) [0xb7d62a01]
/usr/lib/libglib-2.0.so.0(g_logv+0x46a) [0xb7f071fa]
/usr/lib/libglib-2.0.so.0(g_log+0x29) [0xb7f07239]
mono(mono_method_signature+0x315) [0x80f6395]
mono [0x814661b]
mono [0x8156b71]
mono [0x81583b1]
mono [0x807f936]
[0xb7bc1066]
[0xb64af0d5]
[0xb64aeefa]
[0xb64ae59c]
[0xb64ae32a]
[0xb64adb67]
[0xb64ae28d]
[0xb64ae190]
[0xb64f7850]
[0xb64ad013]
[0xb64abe79]
[0xb64abdda]
[0xb64aba42]
[0xb62fc8c0]
[0xb62f6c43]
[0xb745b076]
[0xb745a1c3]
mono(mono_runtime_exec_main+0xbb) [0x809c63b]
mono(mono_runtime_run_main+0x173) [0x809c933]
mono(mono_main+0x6a9) [0x805acd9]
mono [0x805a122]
/lib/tls/i686/cmov/libc.so.6(__libc_start_main+0xe0) [0xb7d4c450]
mono [0x805a091]
Debug info from gdb:
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 0xb7cf4940 (LWP 10526)]
[New Thread 0xb6a59b90 (LWP 10592)]
[New Thread 0xb60edb90 (LWP 10581)]
[New Thread 0xb61eeb90 (LWP 10542)]
[New Thread 0xb6930b90 (LWP 10530)]
[New Thread 0xb6f0eb90 (LWP 10528)]
[New Thread 0xb74adb90 (LWP 10527)]
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
0xb7f96410 in __kernel_vsyscall ()
7 Thread 0xb74adb90 (LWP 10527) 0xb7f96410 in __kernel_vsyscall ()
6 Thread 0xb6f0eb90 (LWP 10528) 0xb7f96410 in __kernel_vsyscall ()
5 Thread 0xb6930b90 (LWP 10530) 0xb7f96410 in __kernel_vsyscall ()
4 Thread 0xb61eeb90 (LWP 10542) 0xb7f96410 in __kernel_vsyscall ()
3 Thread 0xb60edb90 (LWP 10581) 0xb7f96410 in __kernel_vsyscall ()
2 Thread 0xb6a59b90 (LWP 10592) 0xb7f96410 in __kernel_vsyscall ()
1 Thread 0xb7cf4940 (LWP 10526) 0xb7f96410 in __kernel_vsyscall ()
Thread 7 (Thread 0xb74adb90 (LWP 10527)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7eb7196 in nanosleep () from /lib/tls/i686/cmov/libpthread.so.0
#2 0x08105c91 in ?? ()
#3 0xb7eaf4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#4 0xb7e0ce5e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 6 (Thread 0xb6f0eb90 (LWP 10528)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7eb3aa5 in pthread_cond_wait@@GLIBC_2.3.2 ()
from /lib/tls/i686/cmov/libpthread.so.0
#2 0x081088ff in ?? ()
#3 0x0810b3cd in ?? ()
#4 0x0810b43c in ?? ()
#5 0x0811ba1a in ?? ()
#6 0x080b1c0a in ?? ()
#7 0x080cef04 in ?? ()
#8 0x0811a7c2 in ?? ()
#9 0x081317a5 in ?? ()
#10 0xb7eaf4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#11 0xb7e0ce5e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 5 (Thread 0xb6930b90 (LWP 10530)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7e0d676 in epoll_wait () from /lib/tls/i686/cmov/libc.so.6
#2 0x080d0762 in ?? ()
#3 0x080cef04 in ?? ()
#4 0x0811a7c2 in ?? ()
#5 0x081317a5 in ?? ()
#6 0xb7eaf4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#7 0xb7e0ce5e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 4 (Thread 0xb61eeb90 (LWP 10542)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7eb3dd2 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
from /lib/tls/i686/cmov/libpthread.so.0
#2 0x081088e6 in ?? ()
#3 0x0810b3cd in ?? ()
#4 0x0811b8bc in ?? ()
#5 0x080cca8e in ?? ()
#6 0xb6a5c1aa in ?? ()
#7 0xb6a5bfcc in ?? ()
#8 0xb62f5ebe in ?? ()
#9 0xb62f5882 in ?? ()
#10 0xb6ab2fb1 in ?? ()
#11 0x08095ea4 in mono_runtime_delegate_invoke ()
#12 0x080cef6e in ?? ()
#13 0x0811a7c2 in ?? ()
#14 0x081317a5 in ?? ()
#15 0xb7eaf4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#16 0xb7e0ce5e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 3 (Thread 0xb60edb90 (LWP 10581)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7eb6bb8 in accept () from /lib/tls/i686/cmov/libpthread.so.0
#2 0x08117d01 in ?? ()
#3 0x080d5d2b in ?? ()
#4 0xb62f5832 in ?? ()
#5 0xb62f565c in ?? ()
#6 0xb62f54a9 in ?? ()
#7 0xb6a604ba in ?? ()
#8 0xb6aaa501 in ?? ()
#9 0x0809a6b3 in mono_runtime_invoke_array ()
#10 0x0809ad9d in ?? ()
#11 0x080d09e3 in ?? ()
#12 0x080d1d6d in ?? ()
#13 0x080cef04 in ?? ()
#14 0x0811a7c2 in ?? ()
#15 0x081317a5 in ?? ()
#16 0xb7eaf4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#17 0xb7e0ce5e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 2 (Thread 0xb6a59b90 (LWP 10592)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7eb3dd2 in pthread_cond_timedwait@@GLIBC_2.3.2 ()
from /lib/tls/i686/cmov/libpthread.so.0
#2 0x081088ba in ?? ()
#3 0x0810b3cd in ?? ()
#4 0x0811b8bc in ?? ()
#5 0x080d1c52 in ?? ()
#6 0x080cef04 in ?? ()
#7 0x0811a7c2 in ?? ()
#8 0x081317a5 in ?? ()
#9 0xb7eaf4fb in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#10 0xb7e0ce5e in clone () from /lib/tls/i686/cmov/libc.so.6
Thread 1 (Thread 0xb7cf4940 (LWP 10526)):
#0 0xb7f96410 in __kernel_vsyscall ()
#1 0xb7eb699b in read () from /lib/tls/i686/cmov/libpthread.so.0
#2 0xb7f3335d in ?? () from /usr/lib/libglib-2.0.so.0
#3 0xb7f337af in ?? () from /usr/lib/libglib-2.0.so.0
#4 0xb7f341ad in g_spawn_sync () from /usr/lib/libglib-2.0.so.0
#5 0xb7f3466c in g_spawn_command_line_sync () from /usr/lib/libglib-2.0.so.0
#6 0x0816b295 in ?? ()
#7 <signal handler called>
#8 0xb7f96410 in __kernel_vsyscall ()
#9 0xb7d61085 in raise () from /lib/tls/i686/cmov/libc.so.6
#10 0xb7d62a01 in abort () from /lib/tls/i686/cmov/libc.so.6
#11 0xb7f071fa in g_logv () from /usr/lib/libglib-2.0.so.0
#12 0xb7f07239 in g_log () from /usr/lib/libglib-2.0.so.0
#13 0x080f6395 in mono_method_signature ()
#14 0x0814661b in ?? ()
#15 0x08156b71 in ?? ()
#16 0x081583b1 in ?? ()
#17 0x0807f936 in ?? ()
#18 0xb7bc1066 in ?? ()
#19 0xb64af0d5 in ?? ()
#20 0xb64aeefa in ?? ()
#21 0xb64ae59c in ?? ()
#22 0xb64ae32a in ?? ()
#23 0xb64adb67 in ?? ()
#24 0xb64ae28d in ?? ()
#25 0xb64ae190 in ?? ()
#26 0xb64f7850 in ?? ()
#27 0xb64ad013 in ?? ()
#28 0xb64abe79 in ?? ()
#29 0xb64abdda in ?? ()
#30 0xb64aba42 in ?? ()
#31 0xb62fc8c0 in ?? ()
#32 0xb62f6c43 in ?? ()
#33 0xb745b076 in ?? ()
#34 0xb745a1c3 in ?? ()
#35 0x0809c63b in mono_runtime_exec_main ()
#36 0x0809c933 in mono_runtime_run_main ()
#37 0x0805acd9 in mono_main ()
#38 0x0805a122 in ?? ()
#39 0xb7d4c450 in __libc_start_main () from /lib/tls/i686/cmov/libc.so.6
#40 0x0805a091 in ?? ()
#0 0xb7f96410 in __kernel_vsyscall ()
=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Aborted
Code:
using System;
using Server;
using Server.Mobiles;
namespace Server.Misc
{
public class SkillCheck
{
private static readonly bool AntiMacroCode = true; //Change this to false to disable anti-macro code
public static TimeSpan AntiMacroExpire = TimeSpan.FromMinutes( 5.0 ); //How long do we remember targets/locations?
public const int Allowance = 3; //How many times may we use the same location/target for gain
private const int LocationSize = 6; //The size of eeach location, make this smaller so players dont have to move as far
private static bool[] UseAntiMacro = new bool[]
{
// true if this skill uses the anti-macro code, false if it does not
false,// Alchemy = 0,
true,// Anatomy = 1,
true,// AnimalLore = 2,
true,// ItemID = 3,
true,// ArmsLore = 4,
false,// Parry = 5,
true,// Begging = 6,
false,// Blacksmith = 7,
false,// Fletching = 8,
true,// Peacemaking = 9,
true,// Camping = 10,
false,// Carpentry = 11,
false,// Cartography = 12,
false,// Cooking = 13,
true,// DetectHidden = 14,
true,// Discordance = 15,
true,// EvalInt = 16,
true,// Healing = 17,
true,// Fishing = 18,
true,// Forensics = 19,
true,// Herding = 20,
true,// Hiding = 21,
true,// Provocation = 22,
false,// Inscribe = 23,
true,// Lockpicking = 24,
true,// Magery = 25,
true,// MagicResist = 26,
false,// Tactics = 27,
true,// Snooping = 28,
true,// Musicianship = 29,
true,// Poisoning = 30,
false,// Archery = 31,
true,// SpiritSpeak = 32,
true,// Stealing = 33,
false,// Tailoring = 34,
true,// AnimalTaming = 35,
true,// TasteID = 36,
false,// Tinkering = 37,
true,// Tracking = 38,
true,// Veterinary = 39,
false,// Swords = 40,
false,// Macing = 41,
false,// Fencing = 42,
false,// Wrestling = 43,
true,// Lumberjacking = 44,
true,// Mining = 45,
true,// Meditation = 46,
true,// Stealth = 47,
true,// RemoveTrap = 48,
true,// Necromancy = 49,
false,// Focus = 50,
true,// Chivalry = 51
true,// Bushido = 52
true,//Ninjitsu = 53
true // Spellweaving
};
public static void Initialize()
{
Mobile.SkillCheckLocationHandler = new SkillCheckLocationHandler( Mobile_SkillCheckLocation );
Mobile.SkillCheckDirectLocationHandler = new SkillCheckDirectLocationHandler( Mobile_SkillCheckDirectLocation );
Mobile.SkillCheckTargetHandler = new SkillCheckTargetHandler( Mobile_SkillCheckTarget );
Mobile.SkillCheckDirectTargetHandler = new SkillCheckDirectTargetHandler( Mobile_SkillCheckDirectTarget );
}
public static bool Mobile_SkillCheckLocation( Mobile from, SkillName skillName, double minSkill, double maxSkill )
{
Skill skill = from.Skills[skillName];
if ( skill == null )
return false;
double value = skill.Value;
if ( value < minSkill )
return false; // Too difficult
else if ( value >= maxSkill )
return true; // No challenge
double chance = (value - minSkill) / (maxSkill - minSkill);
Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize );
return CheckSkill( from, skill, loc, chance );
}
public static bool Mobile_SkillCheckDirectLocation( Mobile from, SkillName skillName, double chance )
{
Skill skill = from.Skills[skillName];
if ( skill == null )
return false;
if ( chance < 0.0 )
return false; // Too difficult
else if ( chance >= 1.0 )
return true; // No challenge
Point2D loc = new Point2D( from.Location.X / LocationSize, from.Location.Y / LocationSize );
return CheckSkill( from, skill, loc, chance );
}
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;
double gc = (double)(100.0 - skill.Base) / 315.0;
//gc /= 2;
//gc += ( 1.0 - chance ) * ( success ? 0.5 : (Core.AOS ? 0.0 : 0.2) );
//gc /= 2;
//gc *= CheckSkill(skill);
if (skill.Base < 35.0)
gc += 0.15;
if (skill.Base < 45.0)
gc += 0.075;
if ( gc < 0.01 )
gc = 0.01;
if (gc > 0.50)
gc = 0.50;
if ( from is BaseCreature && ((BaseCreature)from).Controlled )
gc *= 2;
if (from.Alive && ((gc >= Utility.RandomDouble() && AllowGain(from, skill, amObj)) || skill.Base < 10.0))
{
if (from is PlayerMobile && !((PlayerMobile)from).CanGain(skill, CheckHunger(from)))
return false;
Gain(from, skill);
}
return success;
}
private static TimeSpan CheckHunger(Mobile from)
{
int hunger = from.Hunger;
int thrist = 0;// from.Thirst;
int check = hunger + thrist;
//check /= 2;
double end;
if (check <= 5) end = 60.0;
else if (check <= 10) end = 50.0;
else if (check <= 15) end = 45.0;
else if (check <= 18) end = 40.0;
else if (check <= 20) end = 35.0;
else end = 60.0;
return TimeSpan.FromSeconds(end);
}
public static bool Mobile_SkillCheckTarget( Mobile from, SkillName skillName, object target, double minSkill, double maxSkill )
{
Skill skill = from.Skills[skillName];
if ( skill == null )
return false;
double value = skill.Value;
if ( value < minSkill )
return false; // Too difficult
else if ( value >= maxSkill )
return true; // No challenge
double chance = (value - minSkill) / (maxSkill - minSkill);
return CheckSkill( from, skill, target, chance );
}
public static bool Mobile_SkillCheckDirectTarget( Mobile from, SkillName skillName, object target, double chance )
{
Skill skill = from.Skills[skillName];
if ( skill == null )
return false;
if ( chance < 0.0 )
return false; // Too difficult
else if ( chance >= 1.0 )
return true; // No challenge
return CheckSkill( from, skill, target, chance );
}
private static bool AllowGain( Mobile from, Skill skill, object obj )
{
if ( AntiMacroCode && from is PlayerMobile && UseAntiMacro[skill.Info.SkillID] )
return ((PlayerMobile)from).AntiMacroCheck( skill, obj );
else
return true;
}
public enum Stat { Str, Dex, Int }
public static void Gain( Mobile from, Skill skill )
{
if ( from.Region.IsPartOf( typeof( Regions.Jail ) ) )
return;
if ( from is BaseCreature && ((BaseCreature)from).IsDeadPet )
return;
if ( skill.SkillName == SkillName.Focus && from is BaseCreature )
return;
if ( skill.Base < skill.Cap && skill.Lock == SkillLock.Up )
{
int toGain = 1;
if ( skill.Base <= 10.0 )
toGain = Utility.Random( 4 ) + 1;
Skills skills = from.Skills;
if ( ( skills.Total / skills.Cap ) >= Utility.RandomDouble() )//( skills.Total >= skills.Cap )
{
for ( int i = 0; i < skills.Length; ++i )
{
Skill toLower = skills[i];
if ( toLower != skill && toLower.Lock == SkillLock.Down && toLower.BaseFixedPoint >= toGain )
{
toLower.BaseFixedPoint -= toGain;
break;
}
}
}
if ( (skills.Total + toGain) <= skills.Cap )
{
skill.BaseFixedPoint += toGain;
}
}
if ( skill.Lock == SkillLock.Up )
{
SkillInfo info = skill.Info;
if (from.StrLock == StatLockType.Up && StrGain(skill) > Utility.RandomDouble())
GainStat( from, Stat.Str );
else if (from.DexLock == StatLockType.Up && DexGain(skill) > Utility.RandomDouble())
GainStat( from, Stat.Dex );
else if (from.IntLock == StatLockType.Up && IntGain(skill) > Utility.RandomDouble())
GainStat( from, Stat.Int );
}
}
#region Statgain
public static double StrGain(Skill theskill)
{
double chance;
switch (theskill.SkillID)
{
case 0: chance = 0.0; break; //Alchemy
case 1: chance = 0.0; break; //Anatomy
case 2: chance = 0.0; break; //Animal Lore
case 3: chance = 0.0; break; //Item Identification
case 4: chance = 0.0; break; //Arms Lore
case 5: chance = 1.0; break; //Parrying
case 6: chance = 0.0; break; //Begging
case 7: chance = 1.25; break; //Blacksmith
case 8: chance = 0.5; break; //Bowcraft/Fletching
case 9: chance = 0.0; break; //Peacemaking
case 10: chance = 0.0; break; //Camping
case 11: chance = 2.0; break; //Carpentry
case 12: chance = 0.0; break; //Cartography
case 13: chance = 0.0; break; //Cooking
case 14: chance = 0.0; break; //Detecting Hidden
case 15: chance = 0.0; break; //Discordance
case 16: chance = 0.0; break; //Evaluating Intelligence
case 17: chance = 0.25; break; //Healing
case 18: chance = 0.25; break; //Fishing
case 19: chance = 0.0; break; //Forensic Evaluation
case 20: chance = 0.0; break; //Herding
case 21: chance = 0.0; break; //Hiding
case 22: chance = 0.0; break; //Provocation
case 23: chance = 0.0; break; //Inscription
case 24: chance = 0.10; break; //Lockpicking
case 25: chance = 0.05; break; //Magery
case 26: chance = 0.0; break; //Resisting Spells
case 27: chance = 0.75; break; //Tactics
case 28: chance = 0.0; break; //Snooping
case 29: chance = 0.0; break; //Musicianship
case 30: chance = 0.0; break; //Poisioning
case 31: chance = 0.75; break; //Archery
case 32: chance = 0.0; break; //Spirit Speak
case 33: chance = 0.0; break; //Stealing
case 34: chance = 0.0; break; //Tailoring
case 35: chance = 0.25; break; //Animal Taming
case 36: chance = 0.05; break; //Taste Identification
case 37: chance = 0.75; break; //Tinkering
case 38: chance = 0.0; break; //Tracking
case 39: chance = 0.05; break; //Veterinary
case 40: chance = 1.25; break; //Swordsmanship
case 41: chance = 1.5; break; //Mace Fighting
case 42: chance = 0.5; break; //Fencing
case 43: chance = 0.75; break; //Wrestling
case 44: chance = 2.0; break; //Lumberjacking
case 45: chance = 2.0; break; // Mining
case 46: chance = 0.0; break; // Meditation
case 47: chance = 0.0; break; //Stealth
case 48: chance = 0.0; break; //Remove Trap
case 49: chance = 0.0; break; //Necromancy
case 50: chance = 0.0; break; // Focus
case 51: chance = 0.0; break; //Chivalry
case 52: chance = 0.0; break; //Bushido
case 53: chance = 0.0; break; //Ninjitsu
case 54: chance = 0.0; break; //Spellweaving
default: chance = 0.4; break; //default
}
return (chance / 33.3);
}
public static double DexGain(Skill theskill)
{
double chance;
switch (theskill.SkillID)
{
case 0: chance = 0.75; break; //Alchemy
case 1: chance = 0.0; break; //Anatomy
case 2: chance = 0.0; break; //Animal Lore
case 3: chance = 0.25; break; //Item Identification
case 4: chance = 0.05; break; //Arms Lore
case 5: chance = 0.5; break; //Parrying
case 6: chance = 0.05; break; //Begging
case 7: chance = 0.5; break; //Blacksmith
case 8: chance = 2.0; break; //Bowcraft/Fletching
case 9: chance = 0.05; break; //Peacemaking
case 10: chance = 0.05; break; //Camping
case 11: chance = 1.0; break; //Carpentry
case 12: chance = 0.05; break; //Cartography
case 13: chance = 0.05; break; //Cooking
case 14: chance = 0.05; break; //Detecting Hidden
case 15: chance = 0.05; break; //Discordance
case 16: chance = 0.0; break; //Evaluating Intelligence
case 17: chance = 0.75; break; //Healing
case 18: chance = 0.25; break; //Fishing
case 19: chance = 0.05; break; //Forensic Evaluation
case 20: chance = 0.25; break; //Herding
case 21: chance = 0.75; break; //Hiding
case 22: chance = 0.10; break; //Provocation
case 23: chance = 0.05; break; //Inscription
case 24: chance = 0.05; break; //Lockpicking
case 25: chance = 0.25; break; //Magery
case 26: chance = 0.05; break; //Resisting Spells
case 27: chance = 0.25; break; //Tactics
case 28: chance = 1.0; break; //Snooping
case 29: chance = 1.0; break; //Musicianship
case 30: chance = 0.05; break; //Poisioning
case 31: chance = 2.0; break; //Archery
case 32: chance = 0.05; break; //Spirit Speak
case 33: chance = 1.0; break; //Stealing
case 34: chance = 1.0; break; //Tailoring
case 35: chance = 0.75; break; //Animal Taming
case 36: chance = 0.05; break; //Taste Identification
case 37: chance = 1.75; break; //Tinkering
case 38: chance = 0.05; break; //Tracking
case 39: chance = 0.05; break; //Veterinary
case 40: chance = 0.75; break; //Swordsmanship
case 41: chance = 0.5; break; //Mace Fighting
case 42: chance = 2.0; break; //Fencing
case 43: chance = 0.75; break; //Wrestling
case 44: chance = 0.5; break; //Lumberjacking
case 45: chance = 0.5; break; // Mining
case 46: chance = 0.0; break; // Meditation
case 47: chance = 1.25; break; //Stealth
case 48: chance = 1.15; break; //Remove Trap
case 49: chance = 0.05; break; //Necromancy
case 50: chance = 0.0; break; // Focus
case 51: chance = 0.05; break; //Chivalry
case 52: chance = 0.05; break; //Bushido
case 53: chance = 0.05; break; //Ninjitsu
case 54: chance = 0.05; break; //Spellweaving
default: chance = 0.05; break; //default
}
return (chance / 33.3);
}
public static double IntGain(Skill theskill)
{
double chance;
switch (theskill.SkillID)
{
case 0: chance = 1.25; break; //Alchemy
case 1: chance = 0.5; break; //Anatomy
case 2: chance = 0.1; break; //Animal Lore
case 3: chance = 0.05; break; //Item Identification
case 4: chance = 0.05; break; //Arms Lore
case 5: chance = 0.05; break; //Parrying
case 6: chance = 0.05; break; //Begging
case 7: chance = 0.25; break; //Blacksmith
case 8: chance = 0.25; break; //Bowcraft/Fletching
case 9: chance = 0.05; break; //Peacemaking
case 10: chance = 0.05; break; //Camping
case 11: chance = 0.05; break; //Carpentry
case 12: chance = 0.05; break; //Cartography
case 13: chance = 0.05; break; //Cooking
case 14: chance = 0.05; break; //Detecting Hidden
case 15: chance = 0.05; break; //Discordance
case 16: chance = 1.0; break; //Evaluating Intelligence
case 17: chance = 1.0; break; //Healing
case 18: chance = 0.05; break; //Fishing
case 19: chance = 0.05; break; //Forensic Evaluation
case 20: chance = 0.05; break; //Herding
case 21: chance = 0.05; break; //Hiding
case 22: chance = 0.05; break; //Provocation
case 23: chance = 1.0; break; //Inscription
case 24: chance = 0.05; break; //Lockpicking
case 25: chance = 2.0; break; //Magery
case 26: chance = 0.5; break; //Resisting Spells
case 27: chance = 0.05; break; //Tactics
case 28: chance = 0.05; break; //Snooping
case 29: chance = 0.05; break; //Musicianship
case 30: chance = 0.05; break; //Poisioning
case 31: chance = 0.25; break; //Archery
case 32: chance = 0.05; break; //Spirit Speak
case 33: chance = 0.05; break; //Stealing
case 34: chance = 0.25; break; //Tailoring
case 35: chance = 0.05; break; //Animal Taming
case 36: chance = 0.05; break; //Taste Identification
case 37: chance = 0.05; break; //Tinkering
case 38: chance = 0.05; break; //Tracking
case 39: chance = 0.05; break; //Veterinary
case 40: chance = 0.05; break; //Swordsmanship
case 41: chance = 0.05; break; //Mace Fighting
case 42: chance = 0.05; break; //Fencing
case 43: chance = 0.25; break; //Wrestling
case 44: chance = 0.05; break; //Lumberjacking
case 45: chance = 0.05; break; // Mining
case 46: chance = 0.75; break; // Meditation
case 47: chance = 0.05; break; //Stealth
case 48: chance = 0.05; break; //Remove Trap
case 49: chance = 0.05; break; //Necromancy
case 50: chance = 0.05; break; // Focus
case 51: chance = 0.05; break; //Chivalry
case 52: chance = 0.05; break; //Bushido
case 53: chance = 0.05; break; //Ninjitsu
case 54: chance = 2.0; break; //Spellweaving
default: chance = 0.05; break; //default
}
return (chance / 33.3);
}
#endregion
public static bool CanLower( Mobile from, Stat stat )
{
switch ( stat )
{
case Stat.Str: return ( from.StrLock == StatLockType.Down && from.RawStr > 10 );
case Stat.Dex: return ( from.DexLock == StatLockType.Down && from.RawDex > 10 );
case Stat.Int: return ( from.IntLock == StatLockType.Down && from.RawInt > 10 );
}
return false;
}
public static bool CanRaise( Mobile from, Stat stat )
{
/*if ( !(from is BaseCreature && ((BaseCreature)from).Controlled) )
{
if ( from.RawStatTotal >= from.StatCap )
return false;
}*/
if (from is PlayerMobile)
{
PlayerMobile pm = from as PlayerMobile;
switch (stat)
{
case Stat.Str: return (from.StrLock == StatLockType.Up && from.RawStr < pm.Lock_Strenght);
case Stat.Dex: return (from.DexLock == StatLockType.Up && from.RawDex < pm.Lock_Dexterity);
case Stat.Int: return (from.IntLock == StatLockType.Up && from.RawInt < pm.Lock_Intelligenz);
}
}
switch ( stat )
{
case Stat.Str: return ( from.StrLock == StatLockType.Up && from.RawStr < 125 );
case Stat.Dex: return ( from.DexLock == StatLockType.Up && from.RawDex < 125 );
case Stat.Int: return ( from.IntLock == StatLockType.Up && from.RawInt < 125 );
}
return false;
}
public static void IncreaseStat( Mobile from, Stat stat, bool atrophy )
{
PlayerMobile pm = from as PlayerMobile;
atrophy = atrophy || (from.RawStatTotal >= from.StatCap);
switch ( stat )
{
case Stat.Str:
{
if ( atrophy )
{
if ( CanLower( from, Stat.Dex ) && (from.RawDex < from.RawInt || !CanLower( from, Stat.Int )) )
--from.RawDex;
else if ( CanLower( from, Stat.Int ) )
--from.RawInt;
}
if ( CanRaise( from, Stat.Str ) )
++from.RawStr;
break;
}
case Stat.Dex:
{
if ( atrophy )
{
if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawInt || !CanLower( from, Stat.Int )) )
--from.RawStr;
else if ( CanLower( from, Stat.Int ) )
--from.RawInt;
}
if ( CanRaise( from, Stat.Dex ) )
++from.RawDex;
break;
}
case Stat.Int:
{
if ( atrophy )
{
if ( CanLower( from, Stat.Str ) && (from.RawStr < from.RawDex || !CanLower( from, Stat.Dex )) )
--from.RawStr;
else if ( CanLower( from, Stat.Dex ) )
--from.RawDex;
}
if ( CanRaise( from, Stat.Int ) )
++from.RawInt;
break;
}
}
}
private static TimeSpan m_StatGainDelay = TimeSpan.FromMinutes( 3.5 );
public static void GainStat( Mobile from, Stat stat )
{
switch( stat )
{
case Stat.Str:
{
if( (from.LastStrGain + m_StatGainDelay) >= DateTime.Now )
return;
from.LastStrGain = DateTime.Now;
break;
}
case Stat.Dex:
{
if( (from.LastDexGain + m_StatGainDelay) >= DateTime.Now )
return;
from.LastDexGain = DateTime.Now;
break;
}
case Stat.Int:
{
if( (from.LastIntGain + m_StatGainDelay) >= DateTime.Now )
return;
from.LastIntGain = DateTime.Now;
break;
}
}
bool atrophy = ( (from.RawStatTotal / (double)from.StatCap) >= Utility.RandomDouble() );
IncreaseStat( from, stat, atrophy );
}
}
}
Is this a Mono bug? Or any suggestions?
thx
Hurraa