crie uma class pra Flowers.cs e add isso
- Código:
using System;
using System.Collections.Generic;
using System.Text;
using NewestCOServer.Game;
namespace NewestCOServer
{
public class Flowers
{
public static void Handle(Main.GameClient GC, byte[] Data)
{
#region Target
string ID = "";
for (byte x = 18; x < 25; x++)
{
ID += Convert.ToChar(Data[x]).ToString();
}
uint TargetID = uint.Parse(ID);
Character SaveChar = (Character)World.H_Chars[TargetID];
http://GC.LocalMessage(2005, "Sending to target id: " + TargetID);//test : D
#endregion
#region Type
string Typing = "";
for (byte x = 25; x < 32; x++)
{
Typing += Convert.ToChar(Data[x]).ToString();
}
string[] SplitValue = Typing.Split(' ');
int Flowers = int.Parse(SplitValue[1]);
int Type = int.Parse(SplitValue[2]);
#endregion
if (GC.MyChar.Body == 2001 || GC.MyChar.Body == 2002)
{ GC.LocalMessage(2005, "You can't send flowers"); return; }
if (World.H_Chars.Contains(TargetID))
{
if (World.AllFlowers.ContainsKey(SaveChar.EntityID))
{
Struct.Flowers F = World.AllFlowers[SaveChar.EntityID];
switch (Type)
{
#region Red Roses
case 0:
{
#region Item
string It = "751";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.RedRoses += Flowers;
F.RedRoses2day += Flowers;
SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
SaveChar.FlowerName = "Red Roses";
break;
}
#endregion
#region Lilies
case 1:
{
#region Item
string It = "752";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.Lilies += Flowers;
F.Lilies2day += Flowers;
SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
SaveChar.FlowerName = "Lilies";
break;
}
#endregion
#region Orchids
case 2:
{
#region Item
string It = "753";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.Orchads += Flowers;
F.Orchads2day += Flowers;
SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
SaveChar.FlowerName = "Orchids";
break;
}
#endregion
#region Tulips
case 3:
{
#region Item
string It = "754";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.Tulips += Flowers;
F.Tulips2day += Flowers;
SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
SaveChar.FlowerName = "Tulips";
break;
}
#endregion
}
GC.Message(2011, "What a love " + GC.MyChar.Name + " has sent " + Flowers.ToString() + " " + SaveChar.FlowerName + " To Precious " + SaveChar.Name + "");
}
else
{
Struct.Flowers F = new Struct.Flowers();
switch (Type)
{
#region Red Roses
case 0:
{
#region Item
string It = "751";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.RedRoses += Flowers;
F.RedRoses2day += Flowers;
SaveChar.FlowerName = "Red Roses";
break;
}
#endregion
#region Lilies
case 1:
{
#region Item
string It = "752";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.Lilies += Flowers;
F.Lilies2day += Flowers;
SaveChar.FlowerName = "Lilies";
break;
}
#endregion
#region Orchids
case 2:
{
#region Item
string It = "753";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.Orchads += Flowers;
F.Orchads2day += Flowers;
SaveChar.FlowerName = "Orchids";
break;
}
#endregion
#region Tulips
case 3:
{
#region Item
string It = "754";
if (Flowers == 1)
It += "001";
else if (Flowers == 3)
It += "003";
else if (Flowers == 9)
It += "009";
else if (Flowers == 99)
It += "099";
else if (Flowers == 999)
It += "999";
#endregion
http://GC.LocalMessage(2005, "Item id : " + It);
GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
F.Tulips += Flowers;
F.Tulips2day += Flowers;
SaveChar.FlowerName = "Tulips";
break;
}
#endregion
default:
Console.WriteLine("Unknown Flower type " + Type);
break;
}
World.AllFlowers.Add(SaveChar.EntityID, F);
SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
GC.Message(2011, "What a love! " + GC.MyChar.Name + " has sent " + Flowers.ToString() + " " + SaveChar.FlowerName + " to your loved " + SaveChar.Name + "...");
}
// Database.SaveFlowerRank(SaveChar);
}
else
{
GC.LocalMessage(2005, "The target player isn't online right now.");
}
}
}
public partial class Struct
{
public class Flowers
{
public int RedRoses;
public int RedRoses2day;
public int Lilies;
public int Lilies2day;
public int Orchads;
public int Orchads2day;
public int Tulips;
public int Tulips2day;
public int Ammount;
}
}
}
depois em character.cs Ctrl+g e procure a linha 1711 add isso
- Código:
public string FlowerName = "";
public Struct.Flowers Flowers = new Struct.Flowers();
Em Packets.cs
- Código:
public static COPacket FlowerPacket(string flowers)
{
byte[] packet = new byte[21 + flowers.Length + 8];
COPacket p = new COPacket(packet);
p.WriteInt16((ushort)(21 + flowers.Length));
p.WriteInt16(1150);
p.WriteInt32(1);
p.Move(8);
p.WriteByte(1);
p.WriteString(flowers);
return p;
}
public static COPacket SendFlowerScreen(uint Id)
{
byte[] Packet = new byte[0x3f2 + 28];
COPacket P = new COPacket(Packet);
P.WriteInt64(0);
P.WriteInt32(Id);
P.WriteInt16((ushort)0x4e0);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt16(0x74);
P.WriteInt64(0);
return P;
}
public static COPacket RankFlowerPacket(string flowers, uint Rank)
{
byte[] packet = new byte[21 + flowers.Length + 8];
COPacket p = new COPacket(packet);
p.WriteInt16((ushort)(21 + flowers.Length));
p.WriteInt16(1150);
p.WriteInt32(2);
p.WriteInt32(Rank);
p.Move(4);
p.WriteByte(1);
p.WriteString(flowers);
return p;
}
public static COPacket ReceiveFlower(int ID, uint Type, uint Rank, uint FlowerType)
{
string flowers = ID.ToString();
byte[] packet = new byte[21 + flowers.Length + 8];
COPacket p = new COPacket(packet);
p.WriteInt16((ushort)(21 + flowers.Length));
p.WriteInt16(1151);
p.WriteInt32(Type);
p.WriteInt32(Rank);
p.WriteInt32(FlowerType);
p.WriteByte(1);
p.WriteString(flowers);
return p;
}
Depois va para PacketHandler.cs e add
- Código:
#region Flowers
case 1150:
{
Flowers.Handle(GC, Data);
break;
}
case 1151:
{
int sub = Data[4];
switch (sub)
{
case 2://View
{
Struct.Flowers F = GC.MyChar.Flowers;
string ToSend = " " + F.RedRoses.ToString() + " " + F.RedRoses2day.ToString() + " " + F.Lilies.ToString() + " " + F.Lilies2day.ToString() + " ";
ToSend += F.Orchads.ToString() + " " + F.Orchads2day.ToString() + " " + F.Tulips.ToString() + " " + F.Tulips2day.ToString();
GC.AddSend(Packets.FlowerPacket(ToSend));
break;
}
default:
{
Console.WriteLine("Unknown 1151 Sub type : " + sub.ToString());
break;
}
}
break;
}
#endregion
agora va para word.cs e procure isso
- Código:
public class World
abaixo add :
- Código:
public static Dictionary<uint, Struct.Flowers> AllFlowers = new Dictionary<uint, Struct.Flowers>();
em database.cs procure:
- Código:
public static void ExpBallReset()
substituiir o code inteiro por este aqui
- Código:
public static void ExpBallReset()
{
foreach (string Path in Directory.GetFiles(@"C:\OldCODB\Users\Characters\"))
{
if (Path.Remove(0, Path.Length - 4) == ".chr")
{
try
{
string Name = Path.Substring(Path.LastIndexOf("\\") + 1, Path.LastIndexOf('.') - Path.LastIndexOf("\\") - 1);
Game.Character C;
C = Game.World.CharacterFromName2(Name);
if (C == null)
{
string Account = "";
C = LoadCharacter(Name, ref Account);
if (C != null)
{
C.ExpBallsUsedToday = 0;
C.LotteryUsed = 0;
C.Flowers.RedRoses2day = 0;
C.Flowers.Lilies2day = 0;
C.Flowers.Tulips2day = 0;
C.Flowers.Orchads2day = 0;
SaveCharacter(C, Account);
}
}
else
{
C.Flowers.RedRoses2day = 0;
C.Flowers.Lilies2day = 0;
C.Flowers.Tulips2day = 0;
C.Flowers.Orchads2day = 0;
C.LotteryUsed = 0;
C.ExpBallsUsedToday = 0;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
}
agora procure
- Código:
public static Game.Character LoadCharacter(string Name, ref string Account)
acima add:
- Código:
public static void RankFloweReset()
{
foreach (string Path in Directory.GetFiles(@"C:\OldCODB\Users\Characters\"))
{
if (Path.Remove(0, Path.Length - 4) == ".chr")
{
try
{
string Name = Path.Substring(Path.LastIndexOf("\\") + 1, Path.LastIndexOf('.') - Path.LastIndexOf("\\") - 1);
Game.Character C;
C = Game.World.CharacterFromName2(Name);
if (C == null)
{
string Account = "";
C = LoadCharacter(Name, ref Account);
if (C != null)
{
C.Flowers.RedRoses = 0;
C.Flowers.RedRoses2day = 0;
C.Flowers.Lilies = 0;
C.Flowers.Lilies2day = 0;
C.Flowers.Tulips = 0;
C.Flowers.Tulips2day = 0;
C.Flowers.Orchads = 0;
C.Flowers.Orchads2day = 0;
SaveCharacter(C, Account);
}
}
else
{
C.Flowers.RedRoses = 0;
C.Flowers.RedRoses2day = 0;
C.Flowers.Lilies = 0;
C.Flowers.Lilies2day = 0;
C.Flowers.Tulips = 0;
C.Flowers.Tulips2day = 0;
C.Flowers.Orchads = 0;
C.Flowers.Orchads2day = 0;
}
}
catch (Exception e)
{
Console.WriteLine(e.ToString());
}
}
}
}
em public static Game.Character LoadCharacter(string Name, ref string Account) procure
- Código:
C.UniversityPoints = BR.ReadUInt32();
abaixo add:
- Código:
C.Flowers.RedRoses = BR.ReadInt32();
C.Flowers.RedRoses2day = BR.ReadInt32();
C.Flowers.Lilies = BR.ReadInt32();
C.Flowers.Lilies2day = BR.ReadInt32();
C.Flowers.Tulips = BR.ReadInt32();
C.Flowers.Tulips2day = BR.ReadInt32();
C.Flowers.Orchads = BR.ReadInt32();
C.Flowers.Orchads2day = BR.ReadInt32();
em public static Game.Robot LoadAsRobot(string Name, ref string Account) procure
- Código:
C.UniversityPoints = BR.ReadUInt32();
abaico add:
- Código:
C.Flowers.RedRoses = BR.ReadInt32();
C.Flowers.RedRoses2day = BR.ReadInt32();
C.Flowers.Lilies = BR.ReadInt32();
C.Flowers.Lilies2day = BR.ReadInt32();
C.Flowers.Tulips = BR.ReadInt32();
C.Flowers.Tulips2day = BR.ReadInt32();
C.Flowers.Orchads = BR.ReadInt32();
C.Flowers.Orchads2day = BR.ReadInt32();
em public static void SaveCharacter(Game.Character C, string Acc) procure
- Código:
BW.Write(C.UniversityPoints);//Quiz Pts
abaixo add:
- Código:
BW.Write(C.Flowers.RedRoses); // Rank Flowers
BW.Write(C.Flowers.RedRoses2day); // Rank Flowers
BW.Write(C.Flowers.Lilies); // Rank Flowers
BW.Write(C.Flowers.Lilies2day); // Rank Flowers
BW.Write(C.Flowers.Tulips); // Rank Flowers
BW.Write(C.Flowers.Tulips2day); // Rank Flowers
BW.Write(C.Flowers.Orchads); // Rank Flowers
BW.Write(C.Flowers.Orchads2day); // Rank Flowers
em public static string CreateCharacter(string Account, string Name, ushort Body, byte Job) procure
- Código:
BW.Write((uint)0);//Quiz Pts
abaixo add:
- Código:
BW.Write((int)0);//RedRoses
BW.Write((int)0);//RedRoses2day
BW.Write((int)0);//Lilies
BW.Write((int)0);//Lilies2day
BW.Write((int)0);//Tulips
BW.Write((int)0);//Tulips2day
BW.Write((int)0);//Orchads
BW.Write((int)0);//Orchads2day
um pouco mais abaixo tem isso
- Código:
C.UniversityPoints = 0;
acima add:
- Código:
C.Flowers.RedRoses = 0;
C.Flowers.RedRoses2day = 0;
C.Flowers.Lilies = 0;
C.Flowers.Lilies2day = 0;
C.Flowers.Orchads = 0;
C.Flowers.Orchads2day = 0;
C.Flowers.Tulips = 0;
C.Flowers.Tulips2day = 0;
C.UniversityPoints = 0;
Agora vamos a Progam.cs e procurem isso :
- Código:
if (Cmd[0] == "/expballs")
Database.ExpBallReset();
acima add:
- Código:
if (Cmd[0] == "/RankFlower")
Database.RankFloweReset();
mais abaixo vc tem :
- Código:
ExpBallClear = true;
Substituir o Codigo inteiro por esse :
- Código:
if (DateTime.Now.Hour == 00 && DateTime.Now.Minute == 00 && DateTime.Now.Second > 0 && DateTime.Now.Hour == 00 && DateTime.Now.Minute == 00 && DateTime.Now.Second < 2 && !ExpBallClear)
{
Database.ExpBallReset();
ExpBallClear = true;
}
if (ExpBallClear && DateTime.Now.Hour == 00 && DateTime.Now.Minute == 00 && DateTime.Now.Second > 1 && DateTime.Now.Hour == 00 && DateTime.Now.Minute == 00 && DateTime.Now.Second < 3)
ExpBallClear = false;
Creditos para 12tails elitepvpers pelo sistema de flores
e Creditos para o Ramix pelo save flowers
Última edição por renansp em Ter Abr 06, 2010 3:56 pm, editado 2 vez(es)