Beispiel #1
0
        public static void SetLevel(MartialClient c, InCommand cmd)
        {
            if (cmd.commandArgs.Length < 2)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "/setlevel [name] [amount]");
                return;
            }

            Character player = WMap.Instance.findPlayerByName(cmd.commandArgs[0]);

            if (player == null)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Wrong player name has been given.");
                return;
            }

            byte level;

            if (!Byte.TryParse(cmd.commandArgs[1], out level))
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Parameters must be values!");
                return;
            }

            if (level < 0 || level > 255)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Setlevel range goes from 0 - 255.");
                return;
            }

            StaticPackets.setCharacterLevel(player, level);
            StaticPackets.sendSystemMessageToClient(c, 1, player.getName() + "'s level has been set up to: " + level + "!");
            return;
        }
Beispiel #2
0
        public static void SetFame(MartialClient c, InCommand cmd)
        {
            if (cmd.commandArgs == null)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "/setfame [name] [amount]");
                return;
            }

            Character player = WMap.Instance.findPlayerByName(cmd.commandArgs[0]);

            if (player == null)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Wrong player name has been given.");
                return;
            }

            int fameAmount;

            if (!Int32.TryParse(cmd.commandArgs[1], out fameAmount))
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Parameters must be values!");
                return;
            }

            if (fameAmount < 0 || fameAmount > 2147483647)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Setfame range goes from 0 - 2147483647.");
                return;
            }

            StaticPackets.setCharacterFame(player, fameAmount);
            StaticPackets.sendSystemMessageToClient(c, 1, player.getName() + "'s fame has been set up to: " + fameAmount + "!");
            return;
        }
Beispiel #3
0
        public static void RequestSpawn(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter != null)
            {
                Logger.LogCheat(Logger.HackTypes.CreateCharacter, c, "Attempted to spawn a character while being ingame.");
                c.Close();
                return;
            }

            byte selected_character = p.ReadByte();

            if (!c.getAccount().characters.ContainsKey(selected_character))
            {
                Logger.LogCheat(Logger.HackTypes.CharacterSelection, c, "Wrong target '{0}' has been selected by selection packet", selected_character);
                c.Close();
                return;
            }

            Character target = c.getAccount().characters[selected_character];

            c.getAccount().activeCharacter = target;

            WMap.Instance.addToCharacters(target);
            CharacterFunctions.setPlayerPosition(target, target.getPosition()[0], target.getPosition()[1], target.getMap());
            CharacterFunctions.calculateCharacterStatistics(target);
            StaticPackets.sendSystemMessageToClient(c, 1, Constants.WelcomeMessage);
        }
Beispiel #4
0
        public static void SetMHP(MartialClient c, InCommand cmd)
        {
            if (cmd.commandArgs.Length != 2)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "/setmhp [name] [amount]");
                return;
            }

            Character player = WMap.Instance.findPlayerByName(cmd.commandArgs[0]);

            if (player == null)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Player wasn't found.");
                return;
            }

            int amount = -1;

            if (!Int32.TryParse(cmd.commandArgs[1], out amount))
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to parse amount of MHPoints.");
                return;
            }

            player.getAccount().MHPoints = amount;
            StaticPackets.setMHPoints(player.getAccount().mClient, amount);
            return;
        }
Beispiel #5
0
 public static void ListCommands(MartialClient c, InCommand cmd)
 {
     StaticPackets.sendSystemMessageToClient(c, 1, "Available commands: ");
     foreach (string cmdName in CommandProcessor.getCommandHandlers().Keys)
     {
         StaticPackets.sendSystemMessageToClient(c, 1, cmdName);
     }
 }
Beispiel #6
0
        public static void Announce(MartialClient c, InCommand cmd)
        {
            if (cmd.commandArgs == null)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "/announce [text]");
                return;
            }
            string announcing = string.Join(" ", cmd.commandArgs);

            StaticPackets.sendWorldAnnounce(announcing);
            return;
        }
Beispiel #7
0
        public static void MoveToInv(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook cargo -> inv while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte fromCargoIndex = p.ReadByte();
            byte toInvSlot      = p.ReadByte();
            byte toInvLine      = p.ReadByte();
            byte toInvRow       = p.ReadByte();

            Cargo     cargo = chr.getCargo();
            Inventory inv   = chr.getInventory();

            Console.WriteLine("Cargo > {0} | {1} | {2} | {3}", fromCargoIndex, toInvSlot, toInvLine, toInvRow);

            cargo.updateCargo();

            if (!cargo.getCargoSaved().ContainsKey((byte)fromCargoIndex))
            {
                Console.WriteLine("Cannot moveItemToInv [item missing]");
                return;
            }
            Item itemF = cargo.getCargoSaved()[(byte)fromCargoIndex];

            if (!inv.moveFromCargo(itemF, fromCargoIndex, toInvRow, toInvLine))
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "do kurwy nendzy");
                return;
            }
            cargo.saveCargo();

            OutPacket op = new OutPacket(24);

            op.WriteInt(24);
            op.WriteShort(4);
            op.WriteShort(45);
            op.WriteInt(1);
            op.WriteInt(chr.getuID());
            op.WriteShort(1);
            op.WriteByte(fromCargoIndex);
            op.WriteByte(toInvSlot);
            op.WriteByte(toInvLine);
            op.WriteByte(toInvRow);
            op.WriteShort(-16625);
            c.WriteRawPacket(op.ToArray());
        }
        public static void warpToNearestTown(Character chr)
        {
            Waypoint closestTown = TownCoordsCache.Instance.getClosestWaypointForMap(chr.getMap(), new Waypoint(chr.getPosition()[0], chr.getPosition()[1]));

            if (closestTown == null)
            {
                Area vvArea = WMap.Instance.getGrid(1).getAreaByRound(-1660, 2344);
                if (vvArea == null)
                {
                    Logger.WriteLog(Logger.LogTypes.Error, "Pure warpToNearestTown error {0}|{1}|{2}", chr.getPosition()[0], chr.getPosition()[1], chr.getMap());
                    StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "We're sorry, but an hard error has occured. Please report it to an admin.");
                    chr.getAccount().mClient.Close();
                    return;
                }
                setPlayerPosition(chr, -1660, 2344, 1);
            }
        }
Beispiel #9
0
        public static void ItemCreate(MartialClient c, InCommand cmd)
        {
            if (cmd.commandArgs == null)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "/item [itemid] [*amount]");
                return;
            }

            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Null activity in command handler");
                c.Close();
                return;
            }
            Character chr = c.getAccount().activeCharacter;

            int itemID = 0;

            Int32.TryParse(cmd.commandArgs[0], out itemID);
            if (itemID < 200000000 || itemID > 299999999)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Item ID range goes from 200.000.000 - 299.999.999.");
                return;
            }
            if (ItemDataCache.Instance.getItemData(itemID).getID() == 0)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Selected item wasn't found.");
                return;
            }

            short itemQuantity = 1;

            Int16.TryParse(cmd.commandArgs[1], out itemQuantity);
            if (itemQuantity > short.MaxValue)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Items amount, can't be bigger than 100!");
                return;
            }

            c.WriteRawPacket(ItemPackets.createDroppedItem(WMap.Instance.items.Count, chr.getPosition()[0], chr.getPosition()[1], itemID, itemQuantity));
            StaticPackets.sendSystemMessageToClient(c, 1, "Item of ID: " + itemID + "|" + WMap.Instance.items.Count + "|" + itemQuantity + ", has been created at coords: ");
            StaticPackets.sendSystemMessageToClient(c, 1, chr.getPosition()[0] + ":" + chr.getPosition()[1] + ":" + chr.getMap() + "!");
            WMap.Instance.items.Add(WMap.Instance.items.Count, new Item(itemID, itemQuantity));
            return;
        }
Beispiel #10
0
        public static void ParseCommand(MartialClient c, string[] cmd)
        {
            InCommand p = new InCommand(cmd[0].ToLower(), cmd.Length == 1 ? null : cmd.Skip(1).ToArray());

            CommandHandler handler = null;

            handler = c_processor[p.commandName];

            if (handler != null)
            {
                handler(c, p);
            }
            else
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "Command '" + cmd[0] + "' wasn't found.");
                return;
            }
        }
Beispiel #11
0
        public static void LearnSkill(MartialClient c, InPacket p)
        {
            Character chr = c.getAccount().activeCharacter;

            byte[] skillNumber = p.ReadBytes(4);
            byte[] skillId     = p.ReadBytes(4);

            int skillNumberInt = BitTools.byteArrayToInt(skillNumber);
            int skillIdInt     = BitTools.byteArrayToInt(skillId);

            if (!SkillDataCache.Instance.canLearnSkill(chr, skillIdInt))
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "You can't learn this skill! [" + skillIdInt + "]");
                return;
            }
            chr.getSkills().learnSkill(skillIdInt, true);

            byte[] learnskill = SkillPackets.getLearnSkillPacket(chr, skillIdInt, skillNumberInt);
            c.WriteRawPacket(learnskill);
        }
Beispiel #12
0
        // Holy Grail ftw
        public static void useItem(Character chr, Item item, byte usingIndex, InPacket p)
        {
            MartialClient c              = chr.getAccount().mClient;
            ItemData      itemData       = ItemDataCache.Instance.getItemData(item.getItemID());
            Boolean       shouldDecrease = false;
            string        determined     = null;
            int           determiner     = 0;

            if (itemData.getIsStackable())
            {
                shouldDecrease = true;
            }
            else
            {
                if (itemData.getTimeToExpire() == 0)
                {
                    shouldDecrease = true;
                }
            }

            // well.. we don't care if it's handled by server.. let's just remove them & f**k haterz! qq
            if (shouldDecrease)
            {
                if (!chr.getInventory().decrementItem(usingIndex))
                {
                    Console.WriteLine("something went wrong with decrement..");
                    return;
                }
            }

            switch (itemData.getCategory())
            {
            case 1001:                     // healingz
            {
                if (itemData.getHealHP() > 0 || itemData.getHealMana() > 0 || itemData.getHealStamina() > 0)
                {
                    StaticPackets.releaseHealPacket(chr, (int)(chr.getCurHP() + itemData.getHealHP()), (short)(chr.getCurMP() + itemData.getHealMana()), (short)(chr.getCurSP() + itemData.getHealStamina()));
                }
                break;
            }

            case 1002:                     // skillz o.o
            {
                StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "If you'd like to learn any skill, go to skills list and press CTRL+LMB.");
                break;
            }

            case 1003:                     // teleport
            {
                if (chr.getMap() == itemData.getTeleportMap() || chr.getMap() != itemData.getTeleportMap() && itemData.getSpecialEffect() != 0)
                {
                    CharacterFunctions.setPlayerPosition(chr, itemData.getTeleportX(), itemData.getTeleportY(), (short)itemData.getTeleportMap());
                }
                break;
            }

            case 1007:                     // reset skills
            {
                chr.getSkills().resetAll();
                chr.getSkillBar().getSkillBar().Clear();
                break;
            }

            case 1011:                     // effect potions
            {
                chr.setEffect((byte)itemData.getSpecialEffect());
                break;
            }

            case 1012:                     // tae potion
            {
                break;
            }

            case 1013:                     // faction change
            {
                if (chr.getFaction() == 0)
                {
                    return;
                }

                chr.setFaction(chr.getFaction() == 1 ? (byte)2 : (byte)1);
                break;
            }

            case 1015:                     // chuk amulet
            {
                determiner = BitConverter.ToInt32(p.ReadBytes(4), 0);
                if (determiner == 0)
                {
                    return;
                }
                ItemData determinedItem = ItemDataCache.Instance.getItemData(determiner);
                if (determinedItem == null || determinedItem.getCategory() != 1003 || (determiner < 212100146 && determiner > 212100164 && determiner != 212100185 && determiner != 212100187))
                {
                    Console.WriteLine("I CAN'T TURN 10 INTO 20 CHICKENZ");
                    return;
                }
                CharacterFunctions.setPlayerPosition(chr, determinedItem.getTeleportX(), determinedItem.getTeleportY(), (short)determinedItem.getTeleportMap());
                break;
            }

            case 1016:                     // karma amulet
            {
                chr.setKarmaMessagingTimes((short)(chr.getKarmaMessagingTimes() + 1));
                break;
            }

            case 1020:                     // name changer
            {
                p.Skip(4);
                string charName = MiscFunctions.obscureString(p.ReadString(16));
                if (charName.Length < 3 || Regex.Replace(charName, "[^A-Za-z0-9]+", "") != charName || MySQLTool.NameTaken(charName))
                {
                    StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "Wrong input " + charName + ".");
                    return;
                }

                chr.setName(charName);
                determined = charName;

                CharacterFunctions.refreshCharacterForTheWorld(chr);
                break;
            }

            case 1021:                     // face changer
            {
                chr.setFace((byte)itemData.getSpecialEffect());
                break;
            }

            case 1024:
            {
                // yy..?
                break;
            }

            case 1031:                     // red castle
            {
                determiner = BitConverter.ToInt32(p.ReadBytes(4), 0);
                if (determiner == 0)
                {
                    return;
                }
                ItemData determinedItem = ItemDataCache.Instance.getItemData(determiner);
                if (determinedItem == null || determinedItem.getCategory() != 56 || ((determiner < 273001255 && determiner > 273001257) && determiner != 283000472 && determiner != 283000543 && determiner != 283000575 && determiner != 283000614 && determiner != 283000934 && determiner != 283001078 && determiner != 283001373 && determiner != 283001376))
                {
                    Console.WriteLine("I CAN'T TURN 10 INTO 20 CHICKENZ");
                    return;
                }
                CharacterFunctions.setPlayerPosition(chr, determinedItem.getTeleportX(), determinedItem.getTeleportY(), (short)determinedItem.getTeleportMap());
                break;
            }

            default:
            {
                StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "Feature not implemented yet");
                return;
            }
            }

            OutPacket op = new OutPacket(52);

            op.WriteInt(52);
            op.WriteShort(0x04);
            op.WriteShort(0x05);
            op.WriteInt(140328705);
            op.WriteInt(chr.getuID());
            op.WriteShort(0x01);
            op.WriteByte(0x01);
            op.WriteByte(usingIndex);
            op.WriteInt(item.getQuantity());
            op.WriteInt(793149441);
            op.WriteInt(/*determiner > 0 ? determiner : 0*/);
            op.WritePaddedString(determined, 17);
            op.WriteByte(0x90);
            op.WriteByte(0xd2);
            op.WriteByte(0x2a);
            c.WriteRawPacket(op.ToArray());

            OutPacket ops = new OutPacket(40);

            ops.WriteInt(40);
            ops.WriteShort(0x05);
            ops.WriteShort(0x05);
            ops.WriteInt(779458561);
            ops.WriteInt(chr.getuID());
            ops.WriteInt(item.getItemID());
            ops.WritePaddedString(determined, 17);
            ops.WriteByte(0x9e);
            ops.WriteByte(0x0f);
            ops.WriteByte(0xbf);
            WMap.Instance.getGrid(chr.getMap()).sendTo3x3Area(chr, chr.getArea(), ops.ToArray());
        }
Beispiel #13
0
        public static void HandleFriends(MartialClient c, InPacket p)
        {
            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Attempted to hook HandleFriends while not being ingame.");
                c.Close();
                return;
            }

            Character chr = c.getAccount().activeCharacter;

            byte   managementType = p.ReadByte();
            byte   communityIndex = p.ReadByte();
            string personName     = MiscFunctions.obscureString(p.ReadString(16));

            Community com = chr.getCommunity();

            switch (managementType)
            {
            case 0:
            case 1:
            {
                if (!com.addPersona(managementType, communityIndex, personName))
                {
                    StaticPackets.sendSystemMessageToClient(c, 1, "Sorry. Something went wrong!");
                    return;
                }
                break;
            }

            case 2:
            case 3:
            {
                if (!com.removePersona((byte)(managementType - 2), communityIndex))
                {
                    StaticPackets.sendSystemMessageToClient(c, 1, "Sorry. Something went wrong!");
                    return;
                }
                break;
            }

            default:
            {
                //tuffnucks you!
                return;
            }
            }

            OutPacket op = new OutPacket(40);

            op.WriteInt(40);
            op.WriteShort(0x04);
            op.WriteShort(0x31);
            op.WriteInt(134652417);
            op.WriteInt(chr.getuID());
            op.WriteShort(1);
            op.WriteByte(managementType);
            op.WriteByte(communityIndex);
            op.WritePaddedString(personName, 16);
            op.WriteInt(-1089495552);
            c.WriteRawPacket(op.ToArray());
        }
Beispiel #14
0
        public static void Warp(MartialClient c, InCommand cmd)
        {
            if (cmd.commandArgs.Length < 2)
            {
                StaticPackets.sendSystemMessageToClient(c, 1, "/goto [x] [y] [map] | [Mob|NPC|Player] [uID/name] | [map] true");
                return;
            }

            if (c.getAccount().activeCharacter == null)
            {
                Logger.LogCheat(Logger.HackTypes.NullActive, c, "Null activity in command handler");
                c.Close();
                return;
            }
            Character chr = c.getAccount().activeCharacter;

            short goMap = -1;
            float goX   = -1;
            float goY   = -1;

            if (cmd.commandArgs.Length == 2)
            {
                switch (cmd.commandArgs[0].ToLower())
                {
                case "npc":
                {
                    int npcID = -1;
                    if (!Int32.TryParse(cmd.commandArgs[1], out npcID))
                    {
                        StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to parse NPC's ID.");
                        return;
                    }

                    if (WMap.Instance.getNpcs().ElementAtOrDefault(npcID) == null)
                    {
                        StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to find NPC of ID " + npcID + "!");
                        return;
                    }

                    NPC npc = WMap.Instance.getNpcs()[npcID];

                    goMap = npc.getMap();
                    goX   = npc.getPosition()[0];
                    goY   = npc.getPosition()[1];
                    break;
                }

                /*case "mob":
                 * {
                 *      int mobID = -1;
                 *      if(!Int32.TryParse(cmd.commandArgs[1], out mobID))
                 *      {
                 *              StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to parse Mob's ID.");
                 *              return;
                 *      }
                 *
                 *      Mob mob = WMap.Instance.getGrid(chr.getMap()).findMobByuID(mobID);
                 *      if(mob == null)
                 *      {
                 *              StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to find Mob of ID " + mobID + "!");
                 *              return;
                 *      }
                 *
                 *      goMap = mob.getMap();
                 *      goX = mob.getPosition()[0];
                 *      goY = mob.getPosition()[1];
                 *      break;
                 * }*/
                case "player":
                {
                    Character player = WMap.Instance.findPlayerByName(cmd.commandArgs[1]);
                    if (player == null)
                    {
                        StaticPackets.sendSystemMessageToClient(c, 1, "Player wasn't found.");
                        return;
                    }

                    goMap = player.getMap();
                    goX   = player.getPosition()[0];
                    goY   = player.getPosition()[1];
                    break;
                }

                default:
                {
                    if (!MiscFunctions.IsNumeric(cmd.commandArgs[0]) || cmd.commandArgs[1] != "true" && !MiscFunctions.IsNumeric(cmd.commandArgs[1]))
                    {
                        StaticPackets.sendSystemMessageToClient(c, 1, "/goto [x] [y] [map] | [Mob|NPC|Player] [uID/name] | [map] true");
                        return;
                    }

                    Waypoint closestTown = null;
                    short    _desiredMap = -1;
                    if (!Int16.TryParse(cmd.commandArgs[0], out _desiredMap))
                    {
                        StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to parse your desired map's ID!");
                        return;
                    }

                    if (cmd.commandArgs[1] == "true")
                    {
                        closestTown = TownCoordsCache.Instance.getClosestWaypointForMap(_desiredMap, new Waypoint(0, 0));
                        if (closestTown == null)
                        {
                            StaticPackets.sendSystemMessageToClient(c, 1, "There's not any town on map " + _desiredMap + "!");
                            return;
                        }
                    }
                    else if (MiscFunctions.IsNumeric(cmd.commandArgs[1]))
                    {
                        int _desiredTown = -1;
                        if (!Int32.TryParse(cmd.commandArgs[1], out _desiredTown))
                        {
                            StaticPackets.sendSystemMessageToClient(c, 1, "Server wasn't able to parse your desired town's index!");
                            return;
                        }

                        closestTown = TownCoordsCache.Instance.getWaypointAtIndexForMap(_desiredMap, _desiredTown);
                        if (closestTown == null)
                        {
                            StaticPackets.sendSystemMessageToClient(c, 1, "There's not any town on map " + _desiredMap + " with index " + _desiredTown + "!");
                            return;
                        }
                    }

                    goMap = Convert.ToInt16(cmd.commandArgs[0]);
                    goX   = closestTown.getX();
                    goY   = closestTown.getY();
                    break;
                }
                }
            }
            else if (cmd.commandArgs.Length == 3)
            {
                foreach (string parser in cmd.commandArgs)
                {
                    if (!MiscFunctions.IsNumeric(parser))
                    {
                        StaticPackets.sendSystemMessageToClient(c, 1, "Parameters must be values!");
                        return;
                    }
                }

                goMap = Convert.ToInt16(cmd.commandArgs[2]);
                goX   = Convert.ToSingle(cmd.commandArgs[0]);
                goY   = Convert.ToSingle(cmd.commandArgs[1]);
            }
            else
            {
                return;
            }

            CharacterFunctions.setPlayerPosition(c.getAccount().activeCharacter, goX, goY, goMap);
            return;
        }
        public static void setPlayerPosition(Character chr, float goX, float goY, short map)
        {
            MartialClient c = chr.getAccount().mClient;

            Logger.WriteLog(Logger.LogTypes.Debug, goX + " | " + goY + " | " + map);

            Area lastArea = chr.getArea();
            Area newArea  = WMap.Instance.getGrid(map).getAreaByRound(goX, goY);

            if (newArea == null)
            {
                StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "The position " + goX + "|" + goY + "|" + map + " can't be reached.");
                Waypoint closestTown = TownCoordsCache.Instance.getClosestWaypointForMap(map, new Waypoint(goX, goY));
                if (closestTown == null)
                {
                    Area vvArea = WMap.Instance.getGrid(1).getAreaByRound(-1660, 2344);
                    if (vvArea == null)
                    {
                        Logger.WriteLog(Logger.LogTypes.Error, "Pure setPlayerPosition error {0}|{1}|{2}", goX, goY, map);
                        StaticPackets.sendSystemMessageToClient(chr.getAccount().mClient, 1, "We're sorry, but an hard error has occured. Please report it to an admin.");
                        c.Close();
                        return;
                    }
                    else
                    {
                        goX     = -1660;
                        goY     = 2344;
                        map     = 1;
                        newArea = vvArea;
                    }
                }
                else
                {
                    goX     = closestTown.getX();
                    goY     = closestTown.getY();
                    newArea = WMap.Instance.getGrid(map).getAreaByRound(goX, goY);
                }
            }

            if (lastArea != null)
            {
                WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaLeave(chr, lastArea);
                lastArea.removeCharacter(chr);
            }

            if (newArea != null)
            {
                chr.setArea(newArea);
            }
            else
            {
                chr.getAccount().mClient.Close();
                return;
            }

            newArea.addCharacter(chr);

            chr.setMap(map);
            chr.setPosition(new float[] { goX, goY });

            OutPacket op = new OutPacket(5840);

            op.WriteInt(5824);
            op.WriteShort(4);                                                          // 4 - 5
            op.WriteShort(1);                                                          // 6 - 7
            op.WriteInt(1);                                                            // 8 - 11
            op.WriteInt(chr.getuID());                                                 // 12 - 15
            op.WriteShort(1);                                                          // 16 - 19
            op.WriteShort(1);                                                          // 16 - 19
            op.WriteInt(chr.getMap());                                                 // 20 - 23
            op.WriteInt(DateTime.Now.Year - 2000);                                     // 24 - 27
            op.WriteByte((byte)DateTime.Now.Month);                                    // 28
            op.WriteByte(DateTime.Now.Day > 30 ? (byte)0x1e : (byte)DateTime.Now.Day); // 29
            op.WriteInt(DateTime.Now.Hour);                                            // 30 - 37

            for (int i = 0; i < 120; i++)
            {
                if (chr.getCargo().getSeqSaved()[i] != -1 && chr.getCargo().getCargoSaved()[chr.getCargo().getSeqSaved()[i]] != null)
                {
                    op.WriteInt();
                    op.WriteByte((byte)(chr.getCargo().getSeqSaved()[i] / 100));
                    op.WriteByte((byte)(chr.getCargo().getSeqSaved()[i] % 100));
                    Item item = chr.getCargo().getCargoSaved()[chr.getCargo().getSeqSaved()[i]];
                    op.WriteInt(item.getItemID());
                    ItemData itemData = ItemDataCache.Instance.getItemData(item.getItemID());
                    if (itemData.getTimeToExpire() > 0)
                    {
                    }
                    op.WriteShort(item.getQuantity());
                }
                else
                {
                    op.WriteZero(12);
                }
            }             // 38 - 1477

            op.Position = 1476;

            for (int i = 0; i < chr.getCommunity().getFriendsList().Capacity; i++)
            {
                if (chr.getCommunity().getFriendsList().ElementAtOrDefault(i) != null)
                {
                    op.WritePaddedString(chr.getCommunity().getFriendsList()[i], 17);
                }
                else
                {
                    op.WriteZero(17);
                }
            }             // 1476 - 1934

            op.WriteRepeatedByte(0x58, 40);

            op.Position = 1986;

            for (int i = 0; i < chr.getCommunity().getIgnoresList().Capacity; i++)
            {
                if (chr.getCommunity().getIgnoresList().ElementAtOrDefault(i) != null)
                {
                    op.WritePaddedString(chr.getCommunity().getIgnoresList()[i], 17);
                }
                else
                {
                    op.WriteZero(17);
                }
            }                 // 1987 - 2157

            op.WriteInt(363); // questsy
            op.WriteLong();
            op.WriteLong(138769276674441706);
            op.WriteLong(21692910);
            op.WriteShort();
            op.WriteShort(1);

            op.Position = 2248;

            for (byte i = 0; i < 240; i++)
            {
                if (chr.getInventory().getSeqSaved()[i] != -1 && chr.getInventory().getInvSaved()[chr.getInventory().getSeqSaved()[i]] != null)
                {
                    op.WriteShort();
                    op.WriteByte((byte)(chr.getInventory().getSeqSaved()[i] / 100));
                    op.WriteByte((byte)(chr.getInventory().getSeqSaved()[i] % 100));
                    Item item = chr.getInventory().getInvSaved()[chr.getInventory().getSeqSaved()[i]];
                    op.WriteInt(item.getItemID());
                    op.WriteInt(item.getQuantity());
                }
                else
                {
                    op.WriteZero(12);
                }
            }             // 2252 - 5133

            op.WriteLong(chr.getCoin());

            op.Position = 5140;

            for (byte i = 0; i < 21; i++)
            {
                if (chr.getSkillBar().getSkillBar().ContainsKey(i))
                {
                    int barID = chr.getSkillBar().getSkillBar()[i];
                    if (barID > 200000000)
                    {
                        op.WriteInt(1);
                    }
                    else if (barID > 511)
                    {
                        op.WriteInt(5); barID -= 512;
                    }
                    else if (barID > 255)
                    {
                        op.WriteInt(6); barID -= 256;
                    }
                    else
                    {
                        SkillData skill = SkillDataCache.Instance.getSkill(chr.getSkills().getLearnedSkills().ElementAtOrDefault(barID));
                        if (skill == null)
                        {
                            op.WriteInt(0);
                        }
                        else if (skill.getTypeSpecific() == 6)
                        {
                            op.WriteInt(3);
                        }
                        else if (skill.getTypeSpecific() == 7)
                        {
                            op.WriteInt(4);
                        }
                        else
                        {
                            op.WriteInt(2);
                        }
                    }
                    op.WriteInt(barID);
                }
                else
                {
                    op.WriteZero(8);
                }
            }             // 5140 - 5299

            op.Position = 5320;

            for (int i = 0; i < 60; i++)
            {
                if (chr.getSkills().getLearnedSkills().Count > i && chr.getSkills().getLearnedSkills()[i] != 0)
                {
                    op.WriteInt(chr.getSkills().getLearnedSkills()[i]);
                    op.WriteInt(SkillDataCache.Instance.getSkill(chr.getSkills().getLearnedSkills()[i]).getSkillPoints());
                }
                else
                {
                    op.WriteLong();
                }
            }             // 5320 - 5799

            op.WriteFloat(chr.getPosition()[0]);
            op.WriteFloat(chr.getPosition()[1]);
            op.WriteInt(0x0c);
            op.WriteInt(140338688);
            op.WriteInt();
            op.WriteShort();
            op.WriteShort(10962);

            //s3c0nd p4ck3t
            op.WriteInt(16);
            op.WriteInt(7929861);
            op.WriteInt(chr.getuID());
            c.WriteRawPacket(op.ToArray());

            WMap.Instance.getGrid(chr.getMap()).sendTo3x3AreaSpawn(chr, chr.getArea());
        }