|
المشاركات 1,940 |
+التقييم 0.95 |
تاريخ التسجيل Apr 2019 |
الاقامة https://www.facebook.com/daany |
نظام التشغيل |
رقم العضوية 1 |
using System;
using System.Linq;
using System.Text;
using code.Client;
using System.Collections.Generic;
using code.Network.GamePackets;
using System.Collections.Concurrent;
using code.Rangers.Inner;
namespace code.Game.Features
{
public unsafe class Flowers
{
public enum Effect : byte
{
None = 0,
Rouse = 1,
Lilies = 2,
Orchids = 3,
Tulips = 4,
Kiss = 1,
love = 2,
Tins = 3,
Jade = 4,
}
public enum FlowersT : byte
{
Rouse = 0,
Lilies = 1,
Orchids = 2,
Tulips = 3,
Kiss = 4,
love = 5,
Tins = 6,
Jade = 7,
}
public Flowers()
{
}
public Flowers(uint _UID, string name)
{
UID = _UID;
Name = name;
}
public uint UID;
public uint aFlower = 1;
public uint SendDay = 0;
public string Name = "";
public int SendScreenValue(FlowersT typ, int rak)
{
if (rak == 0 || rak > 100)
return 0;
return (int)(30000002 + (uint)(100 * (byte)typ) + GetRank(rak));
}
public ushort GetRank(int rank)
{
if (rank == 1)
return 0;
if (rank == 2)
return 10000;
if (rank == 3)
return 20000;
if (rank > 3)
return 30000;
return 0;
}
public int BoySendScreenValue(FlowersT typ, int rak)
{
int ret = 0;
if (rak == -1) return 0;
if (rak > 100) return 0;
ret = (int)(30000402 + (uint)(100 * (byte)typ));
return ret;
}
public int RankRoses = 0;
public int RankLilies = 0;//max 10 start with -1.
public int RankOrchids = 0;//max 10 start with -1.
public int RankTuilps = 0;//max 10 start with -1.
public uint RedRoses;//kiss
public uint RedRoses2day;
public uint Lilies;//love
public uint Lilies2day;
public uint Orchads;//wine
public uint Orchads2day;
public uint Tulips;//jade
public uint Tulips2day;
public override string ToString()
{
return UID + "#"
+ Name + "#"
+ RedRoses + "#"
+ RedRoses2day + "#"
+ Lilies + "#"
+ Lilies2day + "#"
+ Orchads + "#"
+ Orchads2day + "#"
+ Tulips + "#"
+ Tulips2day + "#"
+ SendDay + "#"
+ aFlower + "#"
+ 0 + "#"
+ 0 + "#"
+ 0 + "#"
+ 0 + "#"
+ 0 + "#";
}
public void Read(string aLine)
{
if (aLine == "" || aLine == null) return;
string[] line = aLine.Split('#');
UID = uint.Parse(line[0]);
Name = line[1];
RedRoses = uint.Parse(line[2]);
RedRoses2day = uint.Parse(line[3]);
Lilies = uint.Parse(line[4]);
Lilies2day = uint.Parse(line[5]);
Orchads = uint.Parse(line[6]);
Orchads2day = uint.Parse(line[7]);
Tulips = uint.Parse(line[8]);
Tulips2day = uint.Parse(line[9]);
SendDay = uint.Parse(line[10]);
aFlower = uint.Parse(line[11]);
Reset();
}
public void Reset()
{
if (SendDay != DateTime.Now.Day)
{
RedRoses2day = Lilies2day = Orchads2day = Tulips2day = 0;
aFlower = 1;
SendDay = (uint)DateTime.Now.Day;
}
}
public static ConcurrentDictionary<uint, Flowers> Flowers_Poll = new ConcurrentDictionary<uint, Flowers>();
public static ConcurrentDictionary<uint, Flowers> BoyFlowers = new ConcurrentDictionary<uint, Flowers>();
public static Flowers[] KissTop100 = new Flowers[0];
public static Flowers[] LoveTop100 = new Flowers[0];
public static Flowers[] TineTop100 = new Flowers[0];
public static Flowers[] JadeTop100 = new Flowers[0];
public static Flowers[] RedRousesTop100 = new Flowers[0];
public static Flowers[] LiliesTop100 = new Flowers[0];
public static Flowers[] OrchidsTop100 = new Flowers[0];
public static Flowers[] TulipsTop100 = new Flowers[0];
public static object RouseLock = new object();
public static object LilisLock = new object();
public static object OrchidsLock = new object();
public static object TulipsLock = new object();
public static object KissLock = new object();
public static object LoveLock = new object();
public static object TineLock = new object();
public static object JadeLock = new object();
public static List<Flowers> RankKiss = new List<Flowers>();
public static List<Flowers> RankLove = new List<Flowers>();
public static List<Flowers> RankTine = new List<Flowers>();
public static List<Flowers> RankJade = new List<Flowers>();
public static List<Flowers> Rankrose = new List<Flowers>();
public static List<Flowers> Ranklili = new List<Flowers>();
public static List<Flowers> Rankorchid = new List<Flowers>();
public static List<Flowers> RankTulips = new List<Flowers>();
public static void CulculateRankJade(Flowers afflow)
{
lock (JadeLock)
{
try
{
if (!RankJade.Contains(afflow))
RankJade.Add(afflow);
var data = RankJade.ToArray();
Array.Sort(data, (c1, c2) => { return c2.Tulips.CompareTo(c1.Tulips); });
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.Tulips == 0) continue;
if (x < 100)
{
flow.RankTuilps = x;
backUpd.Add(flow);
}
else
flow.RankTuilps = 0;
x++;
}
lock (JadeTop100)
{
RankJade = new List<Flowers>(backUpd);
JadeTop100 = backUpd.ToArray();
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
}
}
public static void CulculateRankTine(Flowers afflow)
{
lock (TineLock)
{
try
{
if (!RankTine.Contains(afflow))
RankTine.Add(afflow);
var data = RankTine.ToArray();
Array.Sort(data, (c1, c2) => { return c2.Orchads.CompareTo(c1.Orchads); });
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.Orchads == 0) continue;
if (x < 100)
{
flow.RankOrchids = x;
backUpd.Add(flow);
}
else
flow.RankOrchids = 0;
x++;
}
lock (TineTop100)
{
RankTine = new List<Flowers>(backUpd);
TineTop100 = backUpd.ToArray();
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
}
}
public static void CulculateRankLove(Flowers afflow)
{
lock (LoveLock)
{
try
{
if (!RankLove.Contains(afflow))
RankLove.Add(afflow);
var data = RankLove.ToArray();
Array.Sort(data, (c1, c2) => { return c2.Lilies.CompareTo(c1.Lilies); });
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.Lilies == 0) continue;
if (x < 100)
{
flow.RankLilies = x;
backUpd.Add(flow);
}
else
flow.RankLilies = 0;
x++;
}
lock (LoveTop100)
{
RankLove = new List<Flowers>(backUpd);
LoveTop100 = backUpd.ToArray();
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
}
}
public static void CulculateRankKiss(Flowers afflow)
{
lock (KissLock)
{
try
{
if (!RankKiss.Contains(afflow))
RankKiss.Add(afflow);
var data = RankKiss.ToArray();
Array.Sort(data, (c1, c2) => { return c2.RedRoses.CompareTo(c1.RedRoses); });
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.RedRoses == 0) continue;
if (x < 100)
{
flow.RankRoses = x;
backUpd.Add(flow);
}
else
flow.RankRoses = 0;
x++;
}
lock (KissTop100)
{
RankKiss = new List<Flowers>(backUpd);
KissTop100 = backUpd.ToArray();
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
}
}
public static void CulculateRankRouse(Flowers afflow)
{
lock (RouseLock)
{
try
{
if (!Rankrose.Contains(afflow))
Rankrose.Add(afflow);
var data = Rankrose.ToArray();
Array.Sort(data, (c1, c2) => { return c2.RedRoses.CompareTo(c1.RedRoses); });
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.RedRoses == 0) continue;
if (x < 100)
{
flow.RankRoses = x;
backUpd.Add(flow);
}
else
{
flow.RankRoses = 0;
}
x++;
}
lock (RedRousesTop100)
{
Rankrose = new List<Flowers>(backUpd);
RedRousesTop100 = backUpd.ToArray();
}
}
catch (Exception e) { Console.WriteLine(e.ToString()); }
}
}
public static void CulculateRankLilies(Flowers afflow)
{
lock (LilisLock)
{
if (!Ranklili.Contains(afflow))
Ranklili.Add(afflow);
var data = Ranklili.ToArray();
Array.Sort(data, (c1, c2) => { return c2.Lilies.CompareTo(c1.Lilies); });
//IEnumerable<Flowers> query = data.OrderBy(redrous => redrous.Tulips);
//var room = query.ToArray();
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.Lilies == 0) continue;
if (x < 100)
{
flow.RankLilies = x;
backUpd.Add(flow);
}
else
{
flow.RankLilies = 0;
}
x++;
}
lock (LiliesTop100)
{
Ranklili = new List<Flowers>(backUpd);
LiliesTop100 = backUpd.ToArray();
}
}
}
public static void CulculateRankOrchids(Flowers afflow)
{
lock (OrchidsLock)
{
if (!Rankorchid.Contains(afflow))
Rankorchid.Add(afflow);
var data = Rankorchid.ToArray();
Array.Sort(data, (c1, c2) => { return c2.Orchads.CompareTo(c1.Orchads); });
//IEnumerable<Flowers> query = data.OrderBy(redrous => redrous.Tulips);
//var room = query.ToArray();
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.Orchads == 0) continue;
if (x < 100)
{
flow.RankOrchids = x;
backUpd.Add(flow);
}
else
{
flow.RankOrchids = 0;
}
x++;
}
lock (OrchidsTop100)
{
Rankorchid = new List<Flowers>(backUpd);
OrchidsTop100 = backUpd.ToArray();
}
}
}
public static void CulculateRankTulips(Flowers afflow)
{
lock (TulipsLock)
{
if (!RankTulips.Contains(afflow))
RankTulips.Add(afflow);
var data = RankTulips.ToArray();
Array.Sort(data, (c1, c2) => { return c2.Tulips.CompareTo(c1.Tulips); });
var room = data.ToArray();
List<Flowers> backUpd = new List<Flowers>();
int x = 1;
foreach (Flowers flow in room)
{
if (flow.Tulips == 0) continue;
if (x < 100)
{
flow.RankTuilps = x;
backUpd.Add(flow);
}
else
{
flow.RankTuilps = 0;
}
x++;
}
lock (TulipsTop100)
{
RankTulips = new List<Flowers>(backUpd);
TulipsTop100 = backUpd.ToArray();
}
}
}
public static void MsgRank(byte[] packet, GameState client)
{
MsgRank ranking = new MsgRank(false, 0);
ranking.Deserialize(packet);
switch (ranking.Mode)
{
case 6://Prestige
{
foreach (var c in Kernel.GamePool.Values)
{
PerfectionManager.CalcAndAdd(c);
}
PerfectionManager.ShowRank(ranking, client);
var index = new byte[11] { 0, 15, 25, 45, 55, 65, 75, 85, 135, 145, 165 };
EntityRank[] Chars = new EntityRank[11];
for (int i = 0; i < Chars.Length; i++)
{
if (i == 0)
Chars[i] = PerfectionManager.Ranking.Values.OrderByDescending(e => e.Prestige).ThenByDescending(x => x.Class).ThenByDescending(x => x.Level).ThenBy(x => x.UID).FirstOrDefault();
else Chars[i] = PerfectionManager.Ranking.Values.Where(x => x.Class >= (index[i] - 5) && x.Class <= index[i]).OrderByDescending(x => x.Prestige).ThenByDescending(x => x.Level).ThenBy(x => x.UID).FirstOrDefault();
}
byte count = 0;
foreach (var zz in Chars) if (zz != null) count++;
var nRanking = new MsgRank(true, count);
nRanking.Mode = 6;
nRanking.Count = count;
for (byte z = 0; z < Chars.Length; z++)
{
var Entity = Chars[z];
if (Entity == null) continue;
nRanking.Append2((uint)(z + 1), (uint)Entity.Prestige, Entity.UID, Entity.Name, Entity.Level, Entity.Class, Entity.Mesh, true);
}
client.Send(nRanking);
break;
}
case Network.GamePackets.MsgRank.Ranking:
{
if (ranking.RankingType == Network.GamePackets.MsgRank.InnerPower)
{
ushort page = ranking.Page;
InnerPower[] list = null;
Func<InnerPower, uint> select = null;
list = InnerPower.InnerPowerRank.GetRankingList();
select = (inner) => { return inner.TotalScore; };
if (list.Length < page * 10) return;
uint count = (uint)Math.Min(list.Length - page * 10, 10);
var nRanking = new Network.GamePackets.MsgRank(true);
nRanking.Mode = Network.GamePackets.MsgRank.Ranking;
nRanking.RankingType = ranking.RankingType;
nRanking.Page = page;
nRanking.RegisteredCount = (ushort)list.Length;
int rank = (int)page * 10;
for (int i = rank; i < rank + count; i++)
{
var current = list[i];
nRanking.Append((uint)(i + 1), (uint)select(current), current.UID, current.Name);
}
client.Send(nRanking);
}
if (ranking.RankingType >= Network.GamePackets.MsgRank.DragonChi && ranking.RankingType <= Network.GamePackets.MsgRank.TurtleChi)
MsgTrainingVitality.ShowGenericRanking(ranking, client);
else if (ranking.RankingType >= Network.GamePackets.MsgRank.RoseFairy && ranking.RankingType <= Network.GamePackets.MsgRank.TulipFairy)
MsgTrainingVitality.ShowGenericRanking2(ranking, client);
else if (ranking.RankingType >= Network.GamePackets.MsgRank.Kiss && ranking.RankingType <= Network.GamePackets.MsgRank.Jade)
MsgTrainingVitality.ShowGenericRanking2(ranking, client);
if (ranking.RankingType >= Network.GamePackets.MsgRank.Prestige && ranking.RankingType <= Network.GamePackets.MsgRank.Prestige + 10)
{
switch (ranking.Mode)
{
case Network.GamePackets.MsgRank.Ranking:
{
foreach (var c in Kernel.GamePool.Values)
{
PerfectionManager.CalcAndAdd(c);
}
PerfectionManager.ShowRank(ranking, client);
return;
}
}
return;
}
break;
}
case Network.GamePackets.MsgRank.QueryCount:
{
if (ranking.RankingType == 70000000)
{
if (client.Player.InnerPower != null)
{
MsgRank genericRanking3 = new MsgRank(true, 1);
genericRanking3.Mode = 2;
genericRanking3.RankingType = ranking.RankingType;
genericRanking3.Count = 1;
genericRanking3.Append((uint)client.Player.InnerPower.Rank, client.Player.InnerPower.TotalScore, client.Player.UID, client.Player.Name);
client.Send(genericRanking3.ToArray());
}
return;
}
/* if (ranking.RankingType == Network.GamePackets.MsgRank.Prestige)
{
if (client.Player.Prestige > 1)
{
MsgRank genericRanking3 = new MsgRank(true, 1);
genericRanking3.Mode = 2;
genericRanking3.RankingType = ranking.RankingType;
genericRanking3.Count = 1;
genericRanking3.Append((uint)PerfectionManager.GetRank(client, ranking.RankingType), (uint)client.Player.Prestige, client.Player.UID, client.Player.Name);
client.Send(genericRanking3.ToArray());
}
return;
}
if (ranking.RankingType >= Network.GamePackets.MsgRank.PrestigeTrojan && ranking.RankingType <= Network.GamePackets.MsgRank.Prestigewing)
{
if (client.Player.Prestige > 1)
{
MsgRank genericRanking3 = new MsgRank(true, 1);
genericRanking3.Mode = 2;
genericRanking3.RankingType = ranking.RankingType;
genericRanking3.Count = 1;
genericRanking3.Append((uint)PerfectionManager.GetRank(client, ranking.RankingType), (uint)client.Player.Prestige, client.Player.UID, client.Player.Name);
client.Send(genericRanking3.ToArray());
}
return;
}*/
if (Flowers.IsGirl((uint)client.Player.Body))
{
if (client.Player.MyFlowers != null)
{
int num61 = -1;
uint num62 = Flowers.CreateMyRank(client, out num61);
packet[4] = 5;
client.Send(packet);
client.Player.FlowerRank = (uint)client.Player.MyFlowers.SendScreenValue((Game.Features.Flowers.FlowersT)num62, num61);
MsgRank genericRanking2 = new MsgRank(true, 1u);
genericRanking2.Mode = 2u;
genericRanking2.RankingType = client.Player.FlowerRank;
genericRanking2.Count = 1u;
int rank = num61;
if (client.Player.MyFlowers.RankRoses < 100 && client.Player.MyFlowers.RankRoses > 0)
{
genericRanking2.RankingType = Network.GamePackets.MsgRank.RoseFairy;
genericRanking2.Append((uint)client.Player.MyFlowers.RankRoses, client.Player.MyFlowers.RedRoses, client.Player.UID, client.Player.Name);
client.Send(genericRanking2.ToArray());
}
if (client.Player.MyFlowers.RankLilies < 100 && client.Player.MyFlowers.RankLilies > 0)
{
genericRanking2.Reset();
genericRanking2.RankingType = Network.GamePackets.MsgRank.LilyFairy;
genericRanking2.Append((uint)client.Player.MyFlowers.RankLilies, client.Player.MyFlowers.Lilies, client.Player.UID, client.Player.Name);
client.Send(genericRanking2.ToArray());
}
if (client.Player.MyFlowers.RankOrchids < 100 && client.Player.MyFlowers.RankOrchids > 0)
{
genericRanking2.Reset();
genericRanking2.RankingType = Network.GamePackets.MsgRank.OrchidFairy;
genericRanking2.Append((uint)client.Player.MyFlowers.RankOrchids, client.Player.MyFlowers.Orchads, client.Player.UID, client.Player.Name);
client.Send(genericRanking2.ToArray());
}
if (client.Player.MyFlowers.RankTuilps < 100 && client.Player.MyFlowers.RankTuilps > 0)
{
if (client.Player.MyFlowers.RankTuilps == 1 && !client.Player.TulipsWing)
{
//client.TitleStorage.Add(6005, 6005, false);
if (client.Player.EquippedWing == 0)
new TitleStorage().AddTitle(client, 6005, 6005, true);
else
new TitleStorage().AddTitle(client, 6005, 6005, false);
client.Player.TulipsWing = true;
}
//Mrali
genericRanking2.Reset();
genericRanking2.RankingType = Network.GamePackets.MsgRank.TulipFairy;
genericRanking2.Append((uint)client.Player.MyFlowers.RankTuilps, client.Player.MyFlowers.Tulips, client.Player.UID, client.Player.Name);
client.Send(genericRanking2.ToArray());
}
packet[4] = 5;
client.Send(packet);
break;
}
break;
}
else
{
if (client.Player.MyFlowers != null)
{
MsgRank genericRanking3 = new MsgRank(true, 1u);
genericRanking3.Mode = 2u;
genericRanking3.RankingType = 30000402u;
genericRanking3.Count = 1u;
if (client.Player.MyFlowers.RankRoses < 100 && client.Player.MyFlowers.RankRoses > 0)
{
genericRanking3.Append((uint)client.Player.MyFlowers.RankRoses, client.Player.MyFlowers.RedRoses, client.Player.UID, client.Player.Name);
client.Send(genericRanking3.ToArray());
}
if (client.Player.MyFlowers.RankLilies < 100 && client.Player.MyFlowers.RankLilies > 0)
{
genericRanking3.Reset();
genericRanking3.Append((uint)client.Player.MyFlowers.RankLilies, client.Player.MyFlowers.Lilies, client.Player.UID, client.Player.Name);
genericRanking3.RankingType = 30000502u;
client.Send(genericRanking3.ToArray());
}
if (client.Player.MyFlowers.RankOrchids < 100 && client.Player.MyFlowers.RankOrchids > 0)
{
genericRanking3.Reset();
genericRanking3.Append((uint)client.Player.MyFlowers.RankOrchids, client.Player.MyFlowers.Orchads, client.Player.UID, client.Player.Name);
genericRanking3.RankingType = 30000602u;
client.Send(genericRanking3.ToArray());
}
if (client.Player.MyFlowers.RankTuilps < 100 && client.Player.MyFlowers.RankTuilps > 0)
{
genericRanking3.Reset();
genericRanking3.Append((uint)client.Player.MyFlowers.RankTuilps, client.Player.MyFlowers.Tulips, client.Player.UID, client.Player.Name);
genericRanking3.RankingType = 30000702u;
client.Send(genericRanking3.ToArray());
}
packet[4] = 5;
client.Send(packet);
break;
}
}
break;
}
/*case Network.GamePackets.MsgRank.TotemRank:
{
PerfectionManager.ShowHighWall(ranking, client);
break;
} */
default:
if (client.Account.State == Database.AccountTable.AccountState.Administrator)
client.Send("Unknown RankID : " + ranking.Mode); break;
}
}
public static void MsgFlower(Client.GameState client, byte[] packet)
{
byte typ1 = packet[4];
uint Target = BitConverter.ToUInt32(packet, 8);
uint ITEM_UID = BitConverter.ToUInt32(packet, 12);
if (IsBoy(client.Player.Body) && typ1 == 0)//boy send
{
switch (ITEM_UID)
{
case 0://send my flower
{
if (client.Player.MyFlowers.aFlower == 0) break;
Client.GameState target_client;
if (Kernel.GamePool.TryGetValue(Target, out target_client))
{
if (!IsGirl(target_client.Player.Body)) return;
client.Player.MyFlowers.aFlower = 0;
client.Player.MyFlowers.SendDay = (uint)DateTime.Now.Day;
target_client.Player.MyFlowers.RedRoses2day += 1;
target_client.Player.MyFlowers.RedRoses += 1;
SendFlower flow = new SendFlower();
flow.Typing = 0;
flow.Effect = (byte)Game.Features.Flowers.Effect.Tulips;
flow.Amount = 1;
flow.SenderName = client.Player.Name;
flow.ReceiverName = target_client.Player.Name;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Rouse;
client.SendScreen(flow.ToArray(), true);
}
break;
}
default:
{
Network.GamePackets.MsgItemInfo Item = null;
if (client.Inventory.TryGetItem(ITEM_UID, out Item))
{
Client.GameState target_client;
if (Kernel.GamePool.TryGetValue(Target, out target_client))
{
if (!IsGirl(target_client.Player.Body)) return;
uint Amount = Item.ID % 1000;
SendFlower flow = new SendFlower();
flow.Typing = typ1;
flow.Amount = Amount;
flow.SenderName = client.Player.Name;
flow.ReceiverName = target_client.Player.Name;
switch (GetFlowerTyp(Item.ID))
{
case (byte)Game.Features.Flowers.FlowersT.Rouse:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Rouse;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Rouse;
target_client.Player.MyFlowers.RedRoses2day += Amount;
target_client.Player.MyFlowers.RedRoses += Amount;
if (Game.Features.Flowers.RedRousesTop100.Length > 98)
{
if (Game.Features.Flowers.RedRousesTop100[98].RedRoses <= target_client.Player.MyFlowers.RedRoses)
{
Game.Features.Flowers.CulculateRankRouse(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankRouse(target_client.Player.MyFlowers);
break;
}
case (byte)Game.Features.Flowers.FlowersT.Lilies:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Lilies;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Lilies;
target_client.Player.MyFlowers.Lilies2day += Amount;
target_client.Player.MyFlowers.Lilies += Amount;
if (Game.Features.Flowers.LiliesTop100.Length > 98)
{
if (Game.Features.Flowers.LiliesTop100[98].Lilies <= target_client.Player.MyFlowers.Lilies)
{
Game.Features.Flowers.CulculateRankLilies(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankLilies(target_client.Player.MyFlowers);
break;
}
case (byte)Game.Features.Flowers.FlowersT.Orchids:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Orchids;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Orchids;
target_client.Player.MyFlowers.Orchads2day += Amount;
target_client.Player.MyFlowers.Orchads += Amount;
if (Game.Features.Flowers.OrchidsTop100.Length > 98)
{
if (Game.Features.Flowers.OrchidsTop100[98].Orchads <= target_client.Player.MyFlowers.Orchads)
{
Game.Features.Flowers.CulculateRankOrchids(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankOrchids(target_client.Player.MyFlowers);
break;
}
case (byte)Game.Features.Flowers.FlowersT.Tulips:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Tulips;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Tulips;
target_client.Player.MyFlowers.Tulips2day += Amount;
target_client.Player.MyFlowers.Tulips += Amount;
if (Game.Features.Flowers.TulipsTop100.Length > 98)
{
if (Game.Features.Flowers.TulipsTop100[98].Tulips <= target_client.Player.MyFlowers.Tulips)
{
Game.Features.Flowers.CulculateRankTulips(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankTulips(target_client.Player.MyFlowers);
break;
}
}
client.Inventory.Remove(Item, Enums.ItemUse.Remove);
client.SendScreen(flow.ToArray(), true);
}
}
break;
}
}
}
else if (IsGirl(client.Player.Body) && typ1 == 1)//girl send
{
switch (ITEM_UID)
{
case 0://curent flower
{
if (client.Player.MyFlowers.aFlower == 0)
return;
Client.GameState target_client;
if (Kernel.GamePool.TryGetValue(Target, out target_client))
{
if (!IsBoy(target_client.Player.Body)) return;
client.Player.MyFlowers.aFlower = 0;
client.Player.MyFlowers.SendDay = (uint)DateTime.Now.Day;
target_client.Player.MyFlowers.RedRoses += 1;
target_client.Player.MyFlowers.RedRoses2day += 1;
SendFlower flow = new SendFlower();
flow.Typing = 1;
flow.Effect = (byte)Game.Features.Flowers.Effect.Kiss;
flow.Amount = 1;
flow.SenderName = client.Player.Name;
flow.ReceiverName = target_client.Player.Name;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Kiss;
client.SendScreen(flow.ToArray(), true);
}
break;
}
default:
{
MsgItemInfo Item = null;
if (client.Inventory.TryGetItem(ITEM_UID, out Item))
{
Client.GameState target_client = null;
if (Kernel.GamePool.TryGetValue(Target, out target_client))
{
if (!IsBoy(target_client.Player.Body)) return;
uint Amount = Item.ID % 1000;
SendFlower flow = new SendFlower();
flow.Typing = 1;
flow.Amount = Amount;
flow.SenderName = client.Player.Name;
flow.ReceiverName = target_client.Player.Name;
switch (GetFlowerTyp(Item.ID))
{
case (byte)Game.Features.Flowers.FlowersT.Rouse:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Kiss;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Kiss;
target_client.Player.MyFlowers.RedRoses2day += Amount;
target_client.Player.MyFlowers.RedRoses += Amount;
if (Game.Features.Flowers.KissTop100.Length > 98)
{
if (Game.Features.Flowers.KissTop100[98].RedRoses <= target_client.Player.MyFlowers.RedRoses)
{
Game.Features.Flowers.CulculateRankKiss(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankKiss(target_client.Player.MyFlowers);
break;
}
case (byte)Game.Features.Flowers.FlowersT.Lilies:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.love;
flow.FType = (byte)Game.Features.Flowers.FlowersT.love;
target_client.Player.MyFlowers.Lilies2day += Amount;
target_client.Player.MyFlowers.Lilies += Amount;
if (Game.Features.Flowers.LoveTop100.Length > 98)
{
if (Game.Features.Flowers.LoveTop100[98].Lilies <= target_client.Player.MyFlowers.Lilies)
{
Game.Features.Flowers.CulculateRankLove(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankLove(target_client.Player.MyFlowers);
break;
}
case (byte)Game.Features.Flowers.FlowersT.Orchids:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Tins;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Tins;
target_client.Player.MyFlowers.Orchads2day += Amount;
target_client.Player.MyFlowers.Orchads += Amount;
if (Game.Features.Flowers.TineTop100.Length > 98)
{
if (Game.Features.Flowers.TineTop100[98].Orchads <= target_client.Player.MyFlowers.Orchads)
{
Game.Features.Flowers.CulculateRankTine(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankTine(target_client.Player.MyFlowers);
break;
}
case (byte)Game.Features.Flowers.FlowersT.Tulips:
{
flow.Effect = (byte)Game.Features.Flowers.Effect.Jade;
flow.FType = (byte)Game.Features.Flowers.FlowersT.Jade;
target_client.Player.MyFlowers.Tulips2day += Amount;
target_client.Player.MyFlowers.Tulips += Amount;
if (Game.Features.Flowers.JadeTop100.Length > 98)
{
if (Game.Features.Flowers.JadeTop100[98].Tulips <= target_client.Player.MyFlowers.Tulips)
{
Game.Features.Flowers.CulculateRankJade(target_client.Player.MyFlowers);
}
}
else Game.Features.Flowers.CulculateRankJade(target_client.Player.MyFlowers);
break;
}
}
client.Inventory.Remove(Item, Enums.ItemUse.Remove);
client.SendScreen(flow.ToArray(), true);
}
}
break;
}
}
}
}
public static uint CreateMyRank(Client.GameState client, out int rank)
{
List<ClientRank> FRanks = new List<ClientRank>()
{
new ClientRank(){Rank = (uint)client.Player.MyFlowers.RankLilies, Amount = client.Player.MyFlowers.Lilies}
, new ClientRank(){Rank = (uint)client.Player.MyFlowers.RankOrchids, Amount = client.Player.MyFlowers.Orchads}
, new ClientRank(){Rank = (uint)client.Player.MyFlowers.RankRoses, Amount = client.Player.MyFlowers.RedRoses}
, new ClientRank(){Rank = (uint)client.Player.MyFlowers.RankTuilps, Amount = client.Player.MyFlowers.Tulips}
};
var array = FRanks.Where((f1) => f1.Rank != 0).ToArray();
Array.Sort(array, (f1, f2) =>
{
int n_rank = f1.Rank.CompareTo(f2.Rank);
if (f2.Rank == f1.Rank)
return f2.Amount.CompareTo(f1.Amount);
return n_rank;
});
if (array != null && array.Length > 0)
{
ClientRank BestRank = array[0];
if (BestRank.Rank != 0)
{
rank = (int)BestRank.Rank;
if (client.Player.MyFlowers.RankLilies == BestRank.Rank && client.Player.MyFlowers.Lilies == BestRank.Amount)
return (byte)Game.Features.Flowers.FlowersT.Lilies;
if (client.Player.MyFlowers.RankOrchids == BestRank.Rank && client.Player.MyFlowers.Orchads == BestRank.Amount)
return (byte)Game.Features.Flowers.FlowersT.Orchids;
if (client.Player.MyFlowers.RankRoses == BestRank.Rank && client.Player.MyFlowers.RedRoses == BestRank.Amount)
return (byte)Game.Features.Flowers.FlowersT.Rouse;
if (client.Player.MyFlowers.RankTuilps == BestRank.Rank && client.Player.MyFlowers.Tulips == BestRank.Amount)
return (byte)Game.Features.Flowers.FlowersT.Tulips;
}
}
rank = 0;
return 0;
}
public static uint GetFlowerTyp(uint ID)
{
if (ID >= 751001 && ID <= 751999 || ID >= 755001 && ID <= 755999)
return (uint)Game.Features.Flowers.FlowersT.Rouse;
if (ID >= 752001 && ID <= 752999 || ID >= 756001 && ID <= 756999)
return (uint)Game.Features.Flowers.FlowersT.Lilies;
if (ID >= 753001 && ID <= 753999 || ID >= 757001 && ID <= 757999)
return (uint)Game.Features.Flowers.FlowersT.Orchids;
if (ID >= 754001 && ID <= 754999 || ID >= 758001 && ID <= 758999)
return (uint)Game.Features.Flowers.FlowersT.Tulips;
return 0;
}
public static bool IsBoy(uint mesh)
{
return mesh == 1005 || mesh == 1006;
}
public static bool IsGirl(uint mesh)
{
return mesh == 2005 || mesh == 2006;
}
public class ClientRank
{
public uint Rank;
public uint Amount;
}
}
}
public static bool IsBoy(uint mesh)
{
return mesh == 1005 || mesh == 1006;
}
public static bool IsGirl(uint mesh)
{
return mesh == 2005 || mesh == 2006;
}
using System.Text;
using code.Game.Features;
namespace code.Network.GamePackets
{
public unsafe class SendFlower : Writer
{
private byte[] Packet;
public SendFlower()
{
Packet = new byte[68];
WriteUInt16(60, 0, Packet);
WriteUInt16(1150, 2, Packet);
}
public uint Typing
{
get { return BitConverter.ToUInt32(Packet, 4); }
set { WriteUInt32(value, 4, Packet); }
}
public string SenderName
{
get { return Encoding.ASCII.GetString(Packet, 16, 16); }
set { WriteString(value, 16, Packet); }
}
public string ReceiverName
{
get { return Encoding.ASCII.GetString(Packet, 32, 16); }
set { WriteString(value, 32, Packet); }
}
public uint Amount
{
get { return BitConverter.ToUInt32(Packet, 48); }
set { WriteUInt32(value, 48, Packet); }
}
public uint FType
{
get { return BitConverter.ToUInt32(Packet, 52); }
set { WriteUInt32(value, 52, Packet); }
}
public uint Effect
{
get { return BitConverter.ToUInt32(Packet, 56); }
set { WriteUInt32(value, 56, Packet); }
}
public void Apprend(Flowers flowers)
{
WriteUInt32(flowers.RedRoses, 16, Packet);
WriteUInt32(flowers.RedRoses2day, 20, Packet);
WriteUInt32(flowers.Lilies, 24, Packet);
WriteUInt32(flowers.Lilies2day, 28, Packet);
WriteUInt32(flowers.Orchads, 32, Packet);
WriteUInt32(flowers.Orchads2day, 36, Packet);
WriteUInt32(flowers.Tulips, 40, Packet);
WriteUInt32(flowers.Tulips2day, 44, Packet);
}
public byte[] ToArray()
{
return Packet;
}
}
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
شرح اضافه وحش BoS | abuhaneen | مشكلات السيرفيرات كونكر الشخصيه | 18 | 2023-10-30 07:21 PM |
حل مشكله رنك الورد مش بيسيف | محمد ياسر | تطوير سيرفرات كونكر | 1 | 2023-07-16 09:54 AM |
دونشن الورد بايظ | disco0o | مشكلات السيرفيرات كونكر الشخصيه | 0 | 2021-07-28 07:33 PM |
اضافه رون | medo2020 | مشكلات السيرفيرات كونكر الشخصيه | 5 | 2020-04-30 06:04 PM |
مطلوب رنك الورد | Adel Abd El Hay | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2019-07-13 10:44 AM |