|
|
المشاركات 2,362 |
+التقييم 0.85 |
تاريخ التسجيل Apr 2019 |
الاقامة Egypt |
نظام التشغيل windows 7 |
رقم العضوية 1 |

[Forge] PlayerName: DataArray action 2 is not handled
// 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;
}
}
}
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);
}
}
}
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;
}
| الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
| الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
| سورس قهر موبايل - النسخة التانية | Conquer Online Mobile 1.1.2.3 | Hazem | تطويرات كونكر موبايل | 99 | اليوم 07:19 AM |
| مشكلة كلينت سورس كونكر موبايل | عبدالرحمن علاء | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2026-11-23 12:38 AM |
| حل مشكلة الرونة اللي مش بتتركب - سورس قهر موبايل النسخة التانية | Hazem | تطويرات كونكر موبايل | 9 | 2026-11-22 04:52 AM |
| سورس Mr_Panda 2D بتعديلي النسخة السهلة بعد حل كل المشاكل | shehabdasten | سورسات كونكر | 61 | 2021-09-10 10:26 AM |
| اندكس سيرفري كريسماس , تصميم جذاب , بوم للمرة التانية | ديسكو الفظيع | صفحات التسجيل كونكر اونلاين | 19 | 2021-01-20 03:51 PM |