Example #1
0
        private void LoadShortcuts(ref ActorPC aChar)
        {
            string            sqlstr;
            int               i;
            DataRowCollection result = null;

            sqlstr = "SELECT * FROM  shortcuts  WHERE charID=" + aChar.charID + "";
            try
            {
                result = db.GetDataTable(sqlstr).Rows;
            }
            catch (Exception ex)
            {
                Logger.ShowError(" can't get shortcuts from database" + ex.Message, null);
                Logger.ShowError(ex, null);
            }
            aChar.ShorcutIDs = new Dictionary <byte, ActorPC.Shortcut>();
            for (i = 0; i < result.Count; i++)
            {
                byte             slot;
                ActorPC.Shortcut sc = new ActorPC.Shortcut();
                slot    = (byte)result[i]["slotnumber"];
                sc.type = (byte)result[i]["type"];
                sc.ID   = (uint)(int)result[i]["itemID"];
                aChar.ShorcutIDs.Add(slot, sc);
            }
        }
Example #2
0
        // 0x0A Packets =========================================

        // 0A 01
        public void OnAddShortcut(SagaMap.Packets.Client.AddShortcut p)
        {
            if (this.state != SESSION_STATE.MAP_LOADED)
            {
                return;
            }
            try
            {
                ActorPC.Shortcut sc = new ActorPC.Shortcut();
                Packets.Server.SendAddShortcut sendPacket = new SagaMap.Packets.Server.SendAddShortcut();
                sendPacket.SetType(p.GetShortcutType());
                sendPacket.SetSlot(p.GetSlotNumber());
                sendPacket.SetID(p.GetIDNumber());
                sc.type = p.GetShortcutType();
                sc.ID   = p.GetIDNumber();
                if (this.Char.ShorcutIDs.ContainsKey(p.GetSlotNumber()))
                {
                    this.Char.ShorcutIDs.Remove(p.GetSlotNumber());
                }
                this.Char.ShorcutIDs.Add(p.GetSlotNumber(), sc);
                this.netIO.SendPacket(sendPacket, this.SessionID);
            }
            catch (Exception ex)
            {
                Logger.ShowWarning("slotid = " + p.GetSlotNumber() + " idfrompacket(p) = " + p.GetIDNumber(), null);
                Logger.ShowError(ex, null);
            }
        }