Hazem
2026-11-19, 03:52 PM
عفواً لايمكن عرض الروابط في الإرشيف
حل مشكلة بلص الحصان اللي مش راضي يتبلص - سورس قهر موبايل النسخة التانية
السلام عليكم
في النسخة التانية لو دخلت Forging وفتحت Compose واخترت الحصان وحطيت حصان تاني مادة ودوست Compose، اللعبة بتسألك تختار شكل الحصان Original ولا New.
بعد ما تختار مفيش أي حاجة بتحصل: الحصان بيفضل زي ما هو، والتقدم مبيزيدش، والحصان اللي حطيته مادة بيفضل في الشنطة.
ونفس الكلام لو دوست Compose All أو Compose Now.
وفي الكونسول هتلاقي سطر زي ده:
[Forge] PlayerName: DataArray action 2 is not handled
السبب
الموبايل بيبعت بلص الحصان في باكت 10292، نفس باكت الحدادة، بس برقم عملية مختلف:
2 لو اخترت Original
3 لو اخترت New
5 لو دوست Compose Now
والسورس كان بيرد على 0 و 6 و 7 بس (Compose العادي للعدة والـ Upgrade والـ Quality)، وأي رقم تاني يرجع الحصان زي ما هو من غير ما يعمل حاجة.
كود بلص الحصان موجود في السورس بس لكلاينت الكمبيوتر، وباكت الموبايل مكانتش بتوصله.
وكمان الحصان ليه جدول نقط مختلف عن العدة في الكلاينت نفسه: من +2 لـ +3 محتاج 90 مش 80، والحصان +2 لما تستخدمه مادة بيدي 30 مش 40. فاستخدمنا جدول الحصان عشان الأرقام تطلع زي اللي الموبايل بيعرضها بالظبط.
الحل
في فولدر Server اللي مع الموضوع ملفين:
src/Qahr.Mobile.Game/Mobile/Forge/MobileForgeNet.Steed.cs
// QahrMobile: Forging > Compose of a steed on the mobile client. After Compose the phone asks "choose your steed's
// appearance" and sends CMsgDataArray 10292 with action 2 (Original) or 3 (New), count u8 5, then count x u32 from 8 =
// the steed UID followed by the material steed UIDs (seen 2026-11-19: 02 02 00 00 <steed> <material>). These are the
// PC MsgUpdateItem CurrentSteed / NewSteed numbers; the phone's packet never reached that code, so the steed stayed as
// it was. Same rules as MsgUpdateItem: Original adds the material's points + its progress; New adds the points only
// and mixes the colour (SocketProgress, the phone's steed colour) 9:1 with the material's. The points are the
// engine's steed tables, not the gear ones (ItemType.StonePlusPoints / ComposePlusPoints): SteedNeedPoints =
// CItem::GetMountItemNextLevIncExp, SteedMaterialPoints = CItem::GetMountItemAddGrade (+2 needs 90, a +2 gives 30).
// "Compose Now" sends action 5 with the steed alone (MsgUpdateItem ChanceUpgradeSteed, closed on the PC server): the
// chance is progress / points needed (the phone shows it, e.g. 10/90 = 11%), +1 on success, the progress is cleared
// either way.
using System.Collections.Generic;
using Qahr.Mobile.Game.MsgServer;
namespace Qahr.Mobile.Forge
{
public static partial class MobileForgeNet
{
const byte ActSteedOriginal = 2, ActSteedNew = 3, ActSteedQuick = 5;
const byte MaxSteedPlus = 12;
static readonly uint[] SteedNeedPoints = { 20, 20, 90, 240, 720, 2160, 6480, 19440, 58320, 2700, 5500, 9000, 0 };
static readonly uint[] SteedMaterialPoints = { 1, 10, 30, 120, 360, 1080, 3240, 9720, 29160 };
static uint SteedNeed(byte plus) { return SteedNeedPoints[System.Math.Min((int)plus, SteedNeedPoints.Length - 1)]; }
static uint SteedPoints(byte plus) { return SteedMaterialPoints[System.Math.Min((int)plus, SteedMaterialPoints.Length - 1)]; }
static bool IsSteedAction(byte action) { return action == ActSteedOriginal || action == ActSteedNew || action == ActSteedQuick; }
static void HandleSteed(Client.GameClient c, ServerSockets.Packet s, byte action, uint uid, List<uint> materials)
{
if (action == ActSteedQuick) QuickComposeSteed(c, s, uid);
else ComposeSteed(c, s, uid, materials, action == ActSteedNew);
}
static void QuickComposeSteed(Client.GameClient c, ServerSockets.Packet s, uint uid)
{
MsgGameItem steed;
if (!c.TryGetItem(uid, out steed)) return;
if (Database.ItemType.ItemPosition(steed.ITEM_ID) != (ushort)Role.Flags.ConquerItem.Steed
|| steed.Plus >= MaxSteedPlus || steed.PlusProgress == 0) { steed.Send(c, s); return; }
byte oldPlus = steed.Plus;
uint progress = steed.PlusProgress;
uint needed = SteedNeed(steed.Plus);
double chance = 100.0 * progress / needed;
if (Pool.GetRandom.Next((int)needed) < progress) steed.Plus++;
steed.PlusProgress = 0;
steed.Mode = Role.Flags.ItemMode.Update;
steed.Send(c, s);
if (steed.Position != 0) c.Equipment.QueryEquipment(c.Equipment.Alternante) ;
Log(c, steed, "steed quick compose at " + chance.ToString("0.#") + "% (progress " + progress + "): +" + oldPlus + " -> +" + steed.Plus);
}
static void ComposeSteed(Client.GameClient c, ServerSockets.Packet s, uint uid, List<uint> materials, bool newLook)
{
MsgGameItem steed;
if (!c.TryGetItem(uid, out steed)) return;
if (Database.ItemType.ItemPosition(steed.ITEM_ID) != (ushort)Role.Flags.ConquerItem.Steed) { steed.Send(c, s); return; }
byte oldPlus = steed.Plus;
int used = 0;
var seen = new HashSet<uint>();
foreach (uint matUid in materials)
{
MsgGameItem mat;
if (steed.Plus >= MaxSteedPlus) break;
if (matUid == uid || !seen.Add(matUid) || !c.Inventory.ClientItems.TryGetValue(matUid, out mat)) continue;
if (Database.ItemType.ItemPosition(mat.ITEM_ID) != (ushort)Role.Flags.ConquerItem.Steed) continue;
steed.PlusProgress += SteedPoints(mat.Plus) + (newLook ? 0 : mat.PlusProgress);
while (steed.Plus < MaxSteedPlus && steed.PlusProgress >= SteedNeed(steed.Plus))
{
steed.PlusProgress -= SteedNeed(steed.Plus);
steed.Plus++;
}
if (steed.Plus >= MaxSteedPlus) steed.PlusProgress = 0;
if (newLook) MixSteedColour(steed, mat);
Take(c, s, mat, 1);
used++;
}
steed.Mode = Role.Flags.ItemMode.Update;
steed.Send(c, s);
if (steed.Position != 0) c.Equipment.QueryEquipment(c.Equipment.Alternante) ;
if (used > 0) Log(c, steed, "steed compose (" + (newLook ? "new look" : "original look") + ") +" + oldPlus + " -> +" + steed.Plus + " (progress " + steed.PlusProgress + ") with " + used + " steed(s)");
}
/// <summary>MsgUpdateItem NewSteed: each colour byte becomes 0.9 x the steed's + 0.1 x the material's + 1.</summary>
static void MixSteedColour(MsgGameItem steed, MsgGameItem mat)
{
uint mixed = 0;
for (int shift = 0; shift <= 16; shift += 8)
{
int mine = (int)(steed.SocketProgress >> shift) & 0xFF, theirs = (int)(mat.SocketProgress >> shift) & 0xFF;
int value = System.Math.Min(255, (int)System.Math.Floor(0.9 * mine) + (int)System.Math.Floor(0.1 * theirs) + 1);
mixed |= (uint)value << shift;
}
steed.SocketProgress = mixed;
steed.ProgresGreen = mixed & 0xFF;
}
}
}
ده ملف جديد فيه بلص الحصان كله.
src/Qahr.Mobile.Game/Mobile/Forge/MobileForgeNet.cs
MobileForgeNet.cs
[PHP]// QahrMobile: Forging > Upgrade (level) and Quality on the mobile client. The phone sends CMsgDataArray 10292
// (seen 2026-10-26: action u8 4, count u8 5, then count x u32 from 8 = target item UID, then (item type, amount)
// pairs, e.g. 1088001 x0, 1088000 x1). The PC MsgDataArray 2032 wants material UIDs instead, and its Dragon Ball
// branch removes the whole stack (mobile Dragon Balls stack to 10000), so 10292 is not mapped in mobile_ids.txt and
// is handled here at the phone's own rates (MobileForgeNet.Upgrade.cs, PhoneRates.cs, Data\content\forge_rates.txt).
// Forge > Quality sends the short form (target, Dragon Ball count), see QualityCountForm. Reply: MsgItemUsuage
// UpgradeMeteor / UpgradeDragonball (dwParam 1 = upgraded, 2 = failed). Hook: Program.Game_Receive.
using System;
using System.Collections.Generic;
using Qahr.Mobile.Game.MsgServer;
using Qahr.Mobile.Phone;
namespace Qahr.Mobile.Forge
{
public static partial class MobileForgeNet
{
public const ushort MsgDataArray = 10292;
const byte ActCompose = 0, ActLevel = 6, ActQuality = 7;
/// <summary>Forge > Quality sends CHero::ImproveItem(uid, count) (CMsgDataArray::Create(int, uint, uint) from
/// CFDlgForingUpQuality::SendUpGradeMsg): two u32s, the target and the number of Dragon Balls (Go fix F30).
/// The (type, amount) pair form still works.</summary>
const byte QualityCountForm = 2;
static readonly HashSet<Role.Flags.ConquerItem> Gear = new HashSet<Role.Flags.ConquerItem>
{
Role.Flags.ConquerItem.Head, Role.Flags.ConquerItem.Necklace, Role.Flags.ConquerItem.Armor,
Role.Flags.ConquerItem.RightWeapon, Role.Flags.ConquerItem.LeftWeapon, Role.Flags.ConquerItem.Ring,
Role.Flags.ConquerItem.Boots, Role.Flags.ConquerItem.AleternanteHead, Role.Flags.ConquerItem.AleternanteNecklace,
Role.Flags.ConquerItem.AleternanteArmor, Role.Flags.ConquerItem.AleternanteRightWeapon,
Role.Flags.ConquerItem.AleternanteLeftWeapon, Role.Flags.ConquerItem.AleternanteRing, Role.Flags.ConquerItem.AleternanteBoots
};
static readonly HashSet<Role.Flags.ConquerItem> QualityOnly = new HashSet<Role.Flags.ConquerItem>
{
Role.Flags.ConquerItem.Fan, Role.Flags.ConquerItem.Tower, Role.Flags.ConquerItem.RidingCrop, Role.Flags.ConquerItem.Wing
};
/// <summary>true = a 10292 packet (handled, even when refused).</summary>
public static bool TryHandle(Client.GameClient c, ServerSockets.Packet stream, ushort packetId)
{
if (packetId != MsgDataArray) return false;
if (c == null || c.Player == null || stream.Size < 12) return true;
try
{
stream.Seek(4);
byte action = stream.ReadUInt8();
byte n = stream.ReadUInt8();
stream.ReadUInt16();
if (n < 1 || stream.Size < 8 + n * 4) return true;
uint target = stream.ReadUInt32();
if (action == ActCompose)
{
var materials = new List<KeyValuePair<uint, uint>>();
for (int i = 1; i + 1 < n; i += 2) materials.Add(new KeyValuePair<uint, uint>(stream.ReadUInt32(), stream.ReadUInt32()));
lock (c)
using (var rec = new ServerSockets.RecycledPacket())
Compose(c, rec.GetStream(), target, materials);
return true;
}
if (IsSteedAction(action))// QahrMobile: steed compose (Original / New look / Compose Now), Mobile/Forge/MobileForgeNet.Steed.cs
{
var steeds = new List<uint>();
for (int i = 1; i < n; i++) steeds.Add(stream.ReadUInt32());
lock (c)
using (var rec = new ServerSockets.RecycledPacket())
HandleSteed(c, rec.GetStream(), action, target, steeds);
return true;
}
var cost = new Dictionary<uint, uint>();
for (int i = 1; i + 1 < n; i += 2)
{
uint type = stream.ReadUInt32(), amount = stream.ReadUInt32();
if (amount > 0) cost[type] = (cost.ContainsKey(type) ? cost[type] : 0) + Math.Min(amount, 1000u);
}
if (action == ActQuality && n == QualityCountForm)
{
uint balls = stream.ReadUInt32();
if (balls > 0) cost[Database.ItemType.DragonBall] = Math.Min(balls, 1000u);
}
lock (c)
{
using (var rec = new ServerSockets.RecycledPacket())
{
var s = rec.GetStream();
if (action == ActLevel) Level(c, s, target, cost);
else if (action == ActQuality) Quality(c, s, target, cost);
else
{
MyConsole.WriteLine("[Forge] " + c.Player.Name + ": DataArray action " + action + " is not handled", ConsoleColor.Yellow);
MsgGameItem it;
if (c.TryGetItem(target, out it)) it.Send(c, s);// the window waits for an answer
}
}
}
}
catch (Exception e) { MyConsole.WriteLine("[Forge] " + c.Player.Name + ": " + e.Message, ConsoleColor.Red); }
return true;
}
static uint Amount(Dictionary<uint, uint> cost, uint type) { uint v; return cost.TryGetValue(type, out v) ? v : 0; }
static uint Apply(Client.GameClient c, ServerSockets.Packet s, MsgGameItem item, uint next, string what, string paid)
{
uint old = item.ITEM_ID;
item.ITEM_ID = next;
item.Mode = Role.Flags.ItemMode.Update;
item.Send(c, s);
if (item.Position != 0) c.Equipment.QueryEquipment(c.Equipment.Alternante) ;
Log(c, item, what + " " + old + " -> " + next + " for " + paid);
return 1;
}
static void Log(Client.GameClient c, MsgGameItem item, string text)
{
MyConsole.WriteLine("[Forge] " + c.Player.Name + " item " + item.UID + ": " + text, ConsoleColor.Cyan);
}
}
}
ده الملف القديم ومتزود فيه 9 سطور بس.
انسخ الاتنين فوق السورس بتاعك واعمل Build وشغل السيرفر.
ولو عايز تعدل بإيدك في MobileForgeNet.cs، دور على السطر ده:
var cost = new Dictionary<uint, uint>();
وحط قبله على طول:
if (IsSteedAction(action))
{
var steeds = new List<uint>();
for (int i = 1; i < n; i++) steeds.Add(stream.ReadUInt32());
lock (c)
using (var rec = new ServerSockets.RecycledPacket())
HandleSteed(c, rec.GetStream(), action, target, steeds);
return true;
}
وبعدين ضيف ملف MobileForgeNet.Steed.cs جنبه.
اللي بيشتغل بعد الحل
Compose بحصان واحد، و Compose All بكل الأحصنة اللي في الشنطة.
Original بيزود التقدم بنقط الحصان المادة وكمان التقدم اللي كان عليه.
New بيزود بالنقط بس ويخلط لون الحصان مع لون الحصان المادة.
Compose Now بيرفع الحصان بنسبة نجاح التقدم اللي عليه زي ما مكتوب تحت الزرار، ولو فشل التقدم بيتصفر زي ما اللعبة بتنبهك.
أقصى حاجة +12.
حل مشكلة بلص الحصان اللي مش راضي يتبلص - سورس قهر موبايل النسخة التانية
السلام عليكم
في النسخة التانية لو دخلت Forging وفتحت Compose واخترت الحصان وحطيت حصان تاني مادة ودوست Compose، اللعبة بتسألك تختار شكل الحصان Original ولا New.
بعد ما تختار مفيش أي حاجة بتحصل: الحصان بيفضل زي ما هو، والتقدم مبيزيدش، والحصان اللي حطيته مادة بيفضل في الشنطة.
ونفس الكلام لو دوست Compose All أو Compose Now.
وفي الكونسول هتلاقي سطر زي ده:
[Forge] PlayerName: DataArray action 2 is not handled
السبب
الموبايل بيبعت بلص الحصان في باكت 10292، نفس باكت الحدادة، بس برقم عملية مختلف:
2 لو اخترت Original
3 لو اخترت New
5 لو دوست Compose Now
والسورس كان بيرد على 0 و 6 و 7 بس (Compose العادي للعدة والـ Upgrade والـ Quality)، وأي رقم تاني يرجع الحصان زي ما هو من غير ما يعمل حاجة.
كود بلص الحصان موجود في السورس بس لكلاينت الكمبيوتر، وباكت الموبايل مكانتش بتوصله.
وكمان الحصان ليه جدول نقط مختلف عن العدة في الكلاينت نفسه: من +2 لـ +3 محتاج 90 مش 80، والحصان +2 لما تستخدمه مادة بيدي 30 مش 40. فاستخدمنا جدول الحصان عشان الأرقام تطلع زي اللي الموبايل بيعرضها بالظبط.
الحل
في فولدر Server اللي مع الموضوع ملفين:
src/Qahr.Mobile.Game/Mobile/Forge/MobileForgeNet.Steed.cs
// QahrMobile: Forging > Compose of a steed on the mobile client. After Compose the phone asks "choose your steed's
// appearance" and sends CMsgDataArray 10292 with action 2 (Original) or 3 (New), count u8 5, then count x u32 from 8 =
// the steed UID followed by the material steed UIDs (seen 2026-11-19: 02 02 00 00 <steed> <material>). These are the
// PC MsgUpdateItem CurrentSteed / NewSteed numbers; the phone's packet never reached that code, so the steed stayed as
// it was. Same rules as MsgUpdateItem: Original adds the material's points + its progress; New adds the points only
// and mixes the colour (SocketProgress, the phone's steed colour) 9:1 with the material's. The points are the
// engine's steed tables, not the gear ones (ItemType.StonePlusPoints / ComposePlusPoints): SteedNeedPoints =
// CItem::GetMountItemNextLevIncExp, SteedMaterialPoints = CItem::GetMountItemAddGrade (+2 needs 90, a +2 gives 30).
// "Compose Now" sends action 5 with the steed alone (MsgUpdateItem ChanceUpgradeSteed, closed on the PC server): the
// chance is progress / points needed (the phone shows it, e.g. 10/90 = 11%), +1 on success, the progress is cleared
// either way.
using System.Collections.Generic;
using Qahr.Mobile.Game.MsgServer;
namespace Qahr.Mobile.Forge
{
public static partial class MobileForgeNet
{
const byte ActSteedOriginal = 2, ActSteedNew = 3, ActSteedQuick = 5;
const byte MaxSteedPlus = 12;
static readonly uint[] SteedNeedPoints = { 20, 20, 90, 240, 720, 2160, 6480, 19440, 58320, 2700, 5500, 9000, 0 };
static readonly uint[] SteedMaterialPoints = { 1, 10, 30, 120, 360, 1080, 3240, 9720, 29160 };
static uint SteedNeed(byte plus) { return SteedNeedPoints[System.Math.Min((int)plus, SteedNeedPoints.Length - 1)]; }
static uint SteedPoints(byte plus) { return SteedMaterialPoints[System.Math.Min((int)plus, SteedMaterialPoints.Length - 1)]; }
static bool IsSteedAction(byte action) { return action == ActSteedOriginal || action == ActSteedNew || action == ActSteedQuick; }
static void HandleSteed(Client.GameClient c, ServerSockets.Packet s, byte action, uint uid, List<uint> materials)
{
if (action == ActSteedQuick) QuickComposeSteed(c, s, uid);
else ComposeSteed(c, s, uid, materials, action == ActSteedNew);
}
static void QuickComposeSteed(Client.GameClient c, ServerSockets.Packet s, uint uid)
{
MsgGameItem steed;
if (!c.TryGetItem(uid, out steed)) return;
if (Database.ItemType.ItemPosition(steed.ITEM_ID) != (ushort)Role.Flags.ConquerItem.Steed
|| steed.Plus >= MaxSteedPlus || steed.PlusProgress == 0) { steed.Send(c, s); return; }
byte oldPlus = steed.Plus;
uint progress = steed.PlusProgress;
uint needed = SteedNeed(steed.Plus);
double chance = 100.0 * progress / needed;
if (Pool.GetRandom.Next((int)needed) < progress) steed.Plus++;
steed.PlusProgress = 0;
steed.Mode = Role.Flags.ItemMode.Update;
steed.Send(c, s);
if (steed.Position != 0) c.Equipment.QueryEquipment(c.Equipment.Alternante) ;
Log(c, steed, "steed quick compose at " + chance.ToString("0.#") + "% (progress " + progress + "): +" + oldPlus + " -> +" + steed.Plus);
}
static void ComposeSteed(Client.GameClient c, ServerSockets.Packet s, uint uid, List<uint> materials, bool newLook)
{
MsgGameItem steed;
if (!c.TryGetItem(uid, out steed)) return;
if (Database.ItemType.ItemPosition(steed.ITEM_ID) != (ushort)Role.Flags.ConquerItem.Steed) { steed.Send(c, s); return; }
byte oldPlus = steed.Plus;
int used = 0;
var seen = new HashSet<uint>();
foreach (uint matUid in materials)
{
MsgGameItem mat;
if (steed.Plus >= MaxSteedPlus) break;
if (matUid == uid || !seen.Add(matUid) || !c.Inventory.ClientItems.TryGetValue(matUid, out mat)) continue;
if (Database.ItemType.ItemPosition(mat.ITEM_ID) != (ushort)Role.Flags.ConquerItem.Steed) continue;
steed.PlusProgress += SteedPoints(mat.Plus) + (newLook ? 0 : mat.PlusProgress);
while (steed.Plus < MaxSteedPlus && steed.PlusProgress >= SteedNeed(steed.Plus))
{
steed.PlusProgress -= SteedNeed(steed.Plus);
steed.Plus++;
}
if (steed.Plus >= MaxSteedPlus) steed.PlusProgress = 0;
if (newLook) MixSteedColour(steed, mat);
Take(c, s, mat, 1);
used++;
}
steed.Mode = Role.Flags.ItemMode.Update;
steed.Send(c, s);
if (steed.Position != 0) c.Equipment.QueryEquipment(c.Equipment.Alternante) ;
if (used > 0) Log(c, steed, "steed compose (" + (newLook ? "new look" : "original look") + ") +" + oldPlus + " -> +" + steed.Plus + " (progress " + steed.PlusProgress + ") with " + used + " steed(s)");
}
/// <summary>MsgUpdateItem NewSteed: each colour byte becomes 0.9 x the steed's + 0.1 x the material's + 1.</summary>
static void MixSteedColour(MsgGameItem steed, MsgGameItem mat)
{
uint mixed = 0;
for (int shift = 0; shift <= 16; shift += 8)
{
int mine = (int)(steed.SocketProgress >> shift) & 0xFF, theirs = (int)(mat.SocketProgress >> shift) & 0xFF;
int value = System.Math.Min(255, (int)System.Math.Floor(0.9 * mine) + (int)System.Math.Floor(0.1 * theirs) + 1);
mixed |= (uint)value << shift;
}
steed.SocketProgress = mixed;
steed.ProgresGreen = mixed & 0xFF;
}
}
}
ده ملف جديد فيه بلص الحصان كله.
src/Qahr.Mobile.Game/Mobile/Forge/MobileForgeNet.cs
MobileForgeNet.cs
[PHP]// QahrMobile: Forging > Upgrade (level) and Quality on the mobile client. The phone sends CMsgDataArray 10292
// (seen 2026-10-26: action u8 4, count u8 5, then count x u32 from 8 = target item UID, then (item type, amount)
// pairs, e.g. 1088001 x0, 1088000 x1). The PC MsgDataArray 2032 wants material UIDs instead, and its Dragon Ball
// branch removes the whole stack (mobile Dragon Balls stack to 10000), so 10292 is not mapped in mobile_ids.txt and
// is handled here at the phone's own rates (MobileForgeNet.Upgrade.cs, PhoneRates.cs, Data\content\forge_rates.txt).
// Forge > Quality sends the short form (target, Dragon Ball count), see QualityCountForm. Reply: MsgItemUsuage
// UpgradeMeteor / UpgradeDragonball (dwParam 1 = upgraded, 2 = failed). Hook: Program.Game_Receive.
using System;
using System.Collections.Generic;
using Qahr.Mobile.Game.MsgServer;
using Qahr.Mobile.Phone;
namespace Qahr.Mobile.Forge
{
public static partial class MobileForgeNet
{
public const ushort MsgDataArray = 10292;
const byte ActCompose = 0, ActLevel = 6, ActQuality = 7;
/// <summary>Forge > Quality sends CHero::ImproveItem(uid, count) (CMsgDataArray::Create(int, uint, uint) from
/// CFDlgForingUpQuality::SendUpGradeMsg): two u32s, the target and the number of Dragon Balls (Go fix F30).
/// The (type, amount) pair form still works.</summary>
const byte QualityCountForm = 2;
static readonly HashSet<Role.Flags.ConquerItem> Gear = new HashSet<Role.Flags.ConquerItem>
{
Role.Flags.ConquerItem.Head, Role.Flags.ConquerItem.Necklace, Role.Flags.ConquerItem.Armor,
Role.Flags.ConquerItem.RightWeapon, Role.Flags.ConquerItem.LeftWeapon, Role.Flags.ConquerItem.Ring,
Role.Flags.ConquerItem.Boots, Role.Flags.ConquerItem.AleternanteHead, Role.Flags.ConquerItem.AleternanteNecklace,
Role.Flags.ConquerItem.AleternanteArmor, Role.Flags.ConquerItem.AleternanteRightWeapon,
Role.Flags.ConquerItem.AleternanteLeftWeapon, Role.Flags.ConquerItem.AleternanteRing, Role.Flags.ConquerItem.AleternanteBoots
};
static readonly HashSet<Role.Flags.ConquerItem> QualityOnly = new HashSet<Role.Flags.ConquerItem>
{
Role.Flags.ConquerItem.Fan, Role.Flags.ConquerItem.Tower, Role.Flags.ConquerItem.RidingCrop, Role.Flags.ConquerItem.Wing
};
/// <summary>true = a 10292 packet (handled, even when refused).</summary>
public static bool TryHandle(Client.GameClient c, ServerSockets.Packet stream, ushort packetId)
{
if (packetId != MsgDataArray) return false;
if (c == null || c.Player == null || stream.Size < 12) return true;
try
{
stream.Seek(4);
byte action = stream.ReadUInt8();
byte n = stream.ReadUInt8();
stream.ReadUInt16();
if (n < 1 || stream.Size < 8 + n * 4) return true;
uint target = stream.ReadUInt32();
if (action == ActCompose)
{
var materials = new List<KeyValuePair<uint, uint>>();
for (int i = 1; i + 1 < n; i += 2) materials.Add(new KeyValuePair<uint, uint>(stream.ReadUInt32(), stream.ReadUInt32()));
lock (c)
using (var rec = new ServerSockets.RecycledPacket())
Compose(c, rec.GetStream(), target, materials);
return true;
}
if (IsSteedAction(action))// QahrMobile: steed compose (Original / New look / Compose Now), Mobile/Forge/MobileForgeNet.Steed.cs
{
var steeds = new List<uint>();
for (int i = 1; i < n; i++) steeds.Add(stream.ReadUInt32());
lock (c)
using (var rec = new ServerSockets.RecycledPacket())
HandleSteed(c, rec.GetStream(), action, target, steeds);
return true;
}
var cost = new Dictionary<uint, uint>();
for (int i = 1; i + 1 < n; i += 2)
{
uint type = stream.ReadUInt32(), amount = stream.ReadUInt32();
if (amount > 0) cost[type] = (cost.ContainsKey(type) ? cost[type] : 0) + Math.Min(amount, 1000u);
}
if (action == ActQuality && n == QualityCountForm)
{
uint balls = stream.ReadUInt32();
if (balls > 0) cost[Database.ItemType.DragonBall] = Math.Min(balls, 1000u);
}
lock (c)
{
using (var rec = new ServerSockets.RecycledPacket())
{
var s = rec.GetStream();
if (action == ActLevel) Level(c, s, target, cost);
else if (action == ActQuality) Quality(c, s, target, cost);
else
{
MyConsole.WriteLine("[Forge] " + c.Player.Name + ": DataArray action " + action + " is not handled", ConsoleColor.Yellow);
MsgGameItem it;
if (c.TryGetItem(target, out it)) it.Send(c, s);// the window waits for an answer
}
}
}
}
catch (Exception e) { MyConsole.WriteLine("[Forge] " + c.Player.Name + ": " + e.Message, ConsoleColor.Red); }
return true;
}
static uint Amount(Dictionary<uint, uint> cost, uint type) { uint v; return cost.TryGetValue(type, out v) ? v : 0; }
static uint Apply(Client.GameClient c, ServerSockets.Packet s, MsgGameItem item, uint next, string what, string paid)
{
uint old = item.ITEM_ID;
item.ITEM_ID = next;
item.Mode = Role.Flags.ItemMode.Update;
item.Send(c, s);
if (item.Position != 0) c.Equipment.QueryEquipment(c.Equipment.Alternante) ;
Log(c, item, what + " " + old + " -> " + next + " for " + paid);
return 1;
}
static void Log(Client.GameClient c, MsgGameItem item, string text)
{
MyConsole.WriteLine("[Forge] " + c.Player.Name + " item " + item.UID + ": " + text, ConsoleColor.Cyan);
}
}
}
ده الملف القديم ومتزود فيه 9 سطور بس.
انسخ الاتنين فوق السورس بتاعك واعمل Build وشغل السيرفر.
ولو عايز تعدل بإيدك في MobileForgeNet.cs، دور على السطر ده:
var cost = new Dictionary<uint, uint>();
وحط قبله على طول:
if (IsSteedAction(action))
{
var steeds = new List<uint>();
for (int i = 1; i < n; i++) steeds.Add(stream.ReadUInt32());
lock (c)
using (var rec = new ServerSockets.RecycledPacket())
HandleSteed(c, rec.GetStream(), action, target, steeds);
return true;
}
وبعدين ضيف ملف MobileForgeNet.Steed.cs جنبه.
اللي بيشتغل بعد الحل
Compose بحصان واحد، و Compose All بكل الأحصنة اللي في الشنطة.
Original بيزود التقدم بنقط الحصان المادة وكمان التقدم اللي كان عليه.
New بيزود بالنقط بس ويخلط لون الحصان مع لون الحصان المادة.
Compose Now بيرفع الحصان بنسبة نجاح التقدم اللي عليه زي ما مكتوب تحت الزرار، ولو فشل التقدم بيتصفر زي ما اللعبة بتنبهك.
أقصى حاجة +12.