
Its good, use it!
Code:
[COLOR="Red"][B][Original LOTF Source Based Code][/B][/COLOR]
Its your guys' lucky day, here is the [B]BASE code[/B] for Bless and LuckyTime.
Created 100% by myself, and yes parts were leaked on E*Pvp.
[B][Variables][/B]
[B][U]World.cs:[/U][/B]
Search for [B]public static Hashtable GWScores = new Hashtable();[/B], under it add:
[code]
public static ArrayList PlayersPraying = new ArrayList(50);
Code:
public uint LuckTime = 0;
public DateTime PrayCasted = DateTime.Now;
public ushort PrayX = 0;
public ushort PrayY = 0;
public bool CastingPray = false;
public bool Praying = false;
public bool CanPray = false;
To make the code work perfect, you have to change one little thing.
Search for public Character(), you will see TheTimer.Interval = 555;. Change the interval to 500.
[Skill]
Search for if (SkillAttributes[0] == 7)
Under it, add the Skill:
Code:
if (SkillId == 9876 && Stamina >= 100)//Bless
{
if (!CastingPray && !Praying)
{
if (!Mining)
{
//Created by Kinshi88
PrayCasted = DateTime.Now;
CastingPray = true;
Stamina = 0;
PrayX = LocX;
PrayY = LocY;
if (World.PlayersPraying.Contains(this))
{
World.PlayersPraying.Remove(this);
World.PlayersPraying.Add(this);
}
else
World.PlayersPraying.Add(this);
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
MyClient.SendPacket(General.MyPackets.Vital(UID, 9, Stamina));
World.UpdateSpawn(MyClient.MyChar);
}
else
MyClient.SendPacket(General.MyPackets.SendMsg(MyClient.MessageId, "SYSTEM", Name, "Cannot cast Bless if you are Mining!", 2005));
}
}
[Usage]
Search for void TimerElapsed(object source, ElapsedEventArgs e)
Under it add the bulk of the coding, which determines LuckyTime, and Starting/Stopping Praying/Casting Pray.
Code:
//----Lucky Time Codes-By Kinshi88-
//--Gain LuckyTime--
if (CastingPray)//Caster
if (LuckTime < (2 * 60 * 60 * 1000))
{
LuckTime += 1500;
if (LuckTime >= (2 * 60 * 60 * 1000))
LuckTime = (2 * 60 * 60 * 1000);
}
if (Praying)//Others
if (LuckTime < (2 * 60 * 60 * 1000))
{
LuckTime += 500;
if (LuckTime >= (2 * 60 * 60 * 1000))
LuckTime = (2 * 60 * 60 * 1000);
}
//------------------
//--Lose LuckyTime--
if (!Praying && !CastingPray)
if (LuckTime > 0)
{
LuckTime -= 500;
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
}
//------------------
//--Caster Stops Luckytime--
if (CastingPray)
{
if (LocX != PrayX || LocY != PrayY)
{
CastingPray = false;
Praying = false;
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
PrayX = 0;
PrayY = 0;
//World.PlayersPraying.Remove(this);
}
else if (!Alive)
{
CastingPray = false;
Praying = false;
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
PrayX = 0;
PrayY = 0;
}
}
//--------------------------
//--Others Start Praying--
foreach (Character Caster in World.PlayersPraying)
{
if (LocMap == Caster.LocMap)
if (this != Caster)
if (Caster.CastingPray)
if ((MyMath.PointDistance(LocX, LocY, Caster.LocX, Caster.LocY) < 4) || (LocX == Caster.LocX && LocY == Caster.LocY))
if (!Praying && !CastingPray)
{
Thread.Sleep(TimeSpan.FromSeconds(3));
{
if (!Mining)
{
Praying = true;
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
}
}
}
}
//------------------------
//--Others Stop Praying--
foreach (Character Caster in World.PlayersPraying)
{
//if (LocMap == Caster.LocMap)
if (this != Caster)
if (MyMath.PointDistance(LocX, LocY, Caster.LocX, Caster.LocY) > 3)
{
if (Praying)
{
Praying = false;
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
}
}
else if (!Caster.CastingPray)
{
if (Praying)
{
Praying = false;
MyClient.SendPacket(General.MyPackets.Vital(UID, 26, GetStat()));
World.UpdateSpawn(this);
MyClient.SendPacket(General.MyPackets.Vital(UID, 29, LuckTime));
}
}
}
//------------------------
[Skill Definition]
Search for public static void DefineSkills(), under it add:
Code:
SkillAttributes[9876] = new ushort[1][];
SkillAttributes[9876][0] = new ushort[6] { 7, 0, 0, 0, 0, 0 };
SkillsDone.Add(9876, 1);
public static ushort[][][] SkillAttributes = new ushort[9877][][];
[Additional Help]
If you get the error: The name 'Thread' does not exist in the current context.
Add using System.Threading; to Character.cs.
Then replace public Timer TheTimer = new Timer(); with public System.Timers.Timer TheTimer = new System.Timers.Timer();
[/code]






