/// <summary> /// Handles SHOP_SELL from server, response to selling an item /// </summary> public static void ShopSell(Packet pkt) { int charNumLeft = pkt.GetInt(); short itemID = pkt.GetShort(); int charGold = pkt.GetInt(); byte weight = pkt.GetChar(); byte maxWeight = pkt.GetChar(); EndlessClient.Character c = World.Instance.MainPlayer.ActiveCharacter; c.UpdateInventoryItem(1, charGold); c.UpdateInventoryItem(itemID, charNumLeft, weight, maxWeight); }
/// <summary> /// Handles SHOP_BUY from server, response to buying an item /// </summary> public static void ShopBuy(Packet pkt) { int charGoldLeft = pkt.GetInt(); short itemID = pkt.GetShort(); int amount = pkt.GetInt(); byte charWeight = pkt.GetChar(); byte charMaxWeight = pkt.GetChar(); EndlessClient.Character c = World.Instance.MainPlayer.ActiveCharacter; c.UpdateInventoryItem(1, charGoldLeft); c.UpdateInventoryItem(itemID, amount, charWeight, charMaxWeight, true); }
/// <summary> /// Handles SHOP_CREATE from server, response to crafting an item /// </summary> public static void ShopCreate(Packet pkt) { short itemID = pkt.GetShort(); byte weight = pkt.GetChar(); byte maxWeight = pkt.GetChar(); EndlessClient.Character c = World.Instance.MainPlayer.ActiveCharacter; c.UpdateInventoryItem(itemID, 1, weight, maxWeight, true); while (pkt.ReadPos != pkt.Length) { if (pkt.PeekShort() <= 0) { break; } c.UpdateInventoryItem(pkt.GetShort(), pkt.GetInt()); } }
//response to StatSkill_Player packet public static void StatSkillPlayer(Packet pkt) { EndlessClient.Character c = World.Instance.MainPlayer.ActiveCharacter; //local ref so less typing c.Stats.statpoints = pkt.GetShort(); c.Stats.SetStr(pkt.GetShort()); c.Stats.SetInt(pkt.GetShort()); c.Stats.SetWis(pkt.GetShort()); c.Stats.SetAgi(pkt.GetShort()); c.Stats.SetCon(pkt.GetShort()); c.Stats.SetCha(pkt.GetShort()); c.Stats.SetMaxHP(pkt.GetShort()); c.Stats.SetMaxTP(pkt.GetShort()); c.Stats.sp = c.Stats.maxsp = pkt.GetShort(); c.MaxWeight = (byte)pkt.GetShort(); c.Stats.SetMinDam(pkt.GetShort()); c.Stats.SetMaxDam(pkt.GetShort()); c.Stats.SetAccuracy(pkt.GetShort()); c.Stats.SetEvade(pkt.GetShort()); c.Stats.SetArmor(pkt.GetShort()); EOGame.Instance.Hud.RefreshStats(); }