Ejemplo n.º 1
0
        static bool OnSaveUIConfig(LoginClient client, CMSG msgID, BinReader data)
        {
            if (client.Character == null)
            {
                return(true);
            }
            uint   type = data.ReadUInt32();
            int    len  = data.ReadInt32();
            string conf = string.Empty;

            if (len > 0)
            {
                try
                {
                    byte[]   compressed = data.ReadBytes((int)(data.BaseStream.Length - data.BaseStream.Position));
                    Inflater inflater   = new Inflater();
                    inflater.SetInput(compressed);
                    byte[] decompressed = new byte[len];
                    inflater.Inflate(decompressed);
                    conf = System.Text.ASCIIEncoding.ASCII.GetString(decompressed);
                }
                catch (Exception e)
                {
                    Console.WriteLine("Failed to decompress config type " + type + ": " + e.Message);
                    return(true);
                }
            }
            switch (type)
            {
            case 0:
                client.Character.UIConfig0 = conf;
                client.Character.Dirty     = true;
                break;

            case 1:
                client.Character.UIConfig1 = conf;
                client.Character.Dirty     = true;
                break;

            case 2:
                client.Character.UIConfig2 = conf;
                client.Character.Dirty     = true;
                break;

            case 3:
                client.Character.UIConfig3 = conf;
                client.Character.Dirty     = true;
                break;

            case 4:
                client.Character.UIConfig4 = conf;
                client.Character.Dirty     = true;
                break;

            default:
                Console.WriteLine("Unknown config type: " + type);
                Console.WriteLine(conf);
                return(true);
            }
            DataServer.Database.SaveObject(client.Character);
            return(true);
        }
Ejemplo n.º 2
0
 static bool OnRequestUIConfig(LoginClient client, CMSG msgID, BinReader data)
 {
     client.SendConfig(data.ReadInt32());
     return(true);
 }
Ejemplo n.º 3
0
 public LogOut(LoginClient client) : base(TimeSpan.FromSeconds(20))
 {
     this.client = client;
 }
Ejemplo n.º 4
0
 static bool OnPlayerLogout(LoginClient client, CMSG msgID, BinReader data)
 {
     client.IsLoggingOut = true;
     LoginServer.LeaveWorld(client);
     return(true);
 }
Ejemplo n.º 5
0
/*
 *              void initialSpells()
 *              {
 *                      if((Character.Spells == null) || (Character.Spells.Length == 0))
 *                      {
 *                              return;
 *                      }
 *                      int slotNum = 1;
 *                      BinWriter w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
 *                      // Unknow byte
 *                      w.Write((byte)0);
 *                      // Number of abilites/spells
 *                      w.Write((ushort)this.Character.Spells.Length);
 *                      foreach(DBKnownSpell knownSpell in this.Character.Spells)
 *                      {
 *                              try
 *                              {
 *                                      // Spell ID : Defensive Stance
 *                                      w.Write((ushort) knownSpell.Spell_Id);
 *                                      // Slot Number
 *                                      w.Write((short)knownSpell.Slot);
 *                                      slotNum++;
 *                              }
 *                              catch (Exception){}//{Chat.System(client, e.InnerException.Message);}
 *                      }
 *                      w.Write((byte)0x00);
 *                      w.Write((byte)0x00);
 *                      Send(w);
 *              }
 */
        void initialSpells()
        {
            Console.WriteLine(Character.Class.ToString());
            BinWriter w = null;

            switch (this.Character.Class)
            {
            case CLASS.WARRIOR:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Defensive Stance
                w.Write((ushort)71);
                // Slot Number
                w.Write((short)1);
                // Spell ID : Berserker Stance
                w.Write((ushort)2458);
                // Slot Number
                w.Write((short)2);
                // Spell ID : WhirlWind
                w.Write((ushort)1680);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.PALADIN:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Divine Shield
                w.Write((ushort)642);
                // Slot Number
                w.Write((short)1);
                // Spell ID : Devotion Aura
                w.Write((ushort)465);
                // Slot Number
                w.Write((short)2);
                // Spell ID : Holy Light
                w.Write((ushort)635);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.HUNTER:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Beast Tracking
                w.Write((ushort)1494);
                // Slot Number
                w.Write((short)1);
                // Spell ID : Beast Soothe
                w.Write((ushort)1513);
                // Slot Number
                w.Write((short)2);
                // Spell ID : Beast Taming
                w.Write((ushort)1515);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.ROGUE:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Backstab
                w.Write((ushort)53);
                // Slot Number
                w.Write((short)1);
                // Spell ID : Stealth
                w.Write((ushort)1784);
                // Slot Number
                w.Write((short)2);
                // Spell ID : Dual Wield
                w.Write((ushort)674);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.PRIEST:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Sleep
                w.Write((ushort)700);
                // Slot Number
                w.Write((short)1);
                // Spell ID : Lesser Heal
                w.Write((ushort)2050);
                // Slot Number
                w.Write((short)2);
                // Spell ID : Shadow Word: Pain
                w.Write((ushort)589);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.SHAMAN:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Lightning Bolt
                w.Write((ushort)403);
                // Slot Number
                w.Write((short)1);

                // Spell ID : Lightning SHield
                w.Write((ushort)324);
                // Slot Number
                w.Write((short)2);

                // Spell ID : Healing Wave
                w.Write((ushort)331);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.MAGE:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Invisibility
                w.Write((ushort)885);
                // Slot Number
                w.Write((short)1);

                // Spell ID : Frost Armor
                w.Write((ushort)168);
                // Slot Number
                w.Write((short)2);

                // Spell ID : FireBall
                w.Write((ushort)133);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.WARLOCK:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Immolate
                w.Write((ushort)348);
                // Slot Number
                w.Write((short)1);

                // Spell ID : Anti-Magic
                w.Write((ushort)1399);
                // Slot Number
                w.Write((short)2);

                // Spell ID : Infernal
                w.Write((ushort)1413);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;

            case CLASS.DRUID:
                w = LoginClient.NewPacket(SMSG.INITIAL_SPELLS);
                // Unknow byte
                w.Write((byte)0);
                // Number of abilites/spells
                w.Write((ushort)3);
                // Spell ID : Polymorph : Pig
                w.Write((ushort)118);
                // Slot Number
                w.Write((short)1);

                // Spell ID : Rejuvenation
                w.Write((ushort)774);
                // Slot Number
                w.Write((short)2);

                // Spell ID : Faerie Fire
                w.Write((ushort)770);
                // Slot Number
                w.Write((short)3);
                w.Write((byte)0x00);
                w.Write((byte)0x00);
                Send(w);
                break;
            }
        }