Esempio n. 1
0
        public List<Portal> GetPortalsByMapId(int mapId)
        {
            DbParameter mapIdParameter = _db.CreateParameter(DbNames.GETPORTALSBYMAPID_ID_PARAMETER, mapId);

            mapIdParameter.DbType = System.Data.DbType.Int32;

            _db.Open();

            DbDataReader reader = _db.ExcecuteReader(DbNames.GETPORTALSBYMAPID_STOREDPROC, System.Data.CommandType.StoredProcedure, mapIdParameter);

            int ordinalMapId = reader.GetOrdinal(DbNames.PORTAL_MAPID);
            int ordinalToMapId = reader.GetOrdinal(DbNames.PORTAL_TOMAPID);
            int ordinalWidth = reader.GetOrdinal(DbNames.PORTAL_WIDTH);
            int ordinalHeight = reader.GetOrdinal(DbNames.PORTAL_HEIGHT);
            int ordinalToX = reader.GetOrdinal(DbNames.PORTAL_TOX);
            int ordinalToY = reader.GetOrdinal(DbNames.PORTAL_TOY);
            int ordinalFromX = reader.GetOrdinal(DbNames.PORTAL_FROMX);
            int ordinalFromY = reader.GetOrdinal(DbNames.PORTAL_FROMY);

            List<Portal> listPortals = new List<Portal>();

            while (reader.Read())
            {
                Portal p = new Portal
                {
                    MapID = reader.GetInt32(ordinalMapId),
                    ToMapID = reader.GetInt32(ordinalToMapId),
                    Width = reader.GetInt16(ordinalWidth),
                    Height = reader.GetInt16(ordinalHeight),
                    ToX = reader.GetInt16(ordinalToX),
                    ToY = reader.GetInt16(ordinalToY),
                    FromX = reader.GetInt16(ordinalFromX),
                    FromY = reader.GetInt16(ordinalFromY)
                };

                listPortals.Add(p);
            }

            reader.Close();
            _db.Close();

            return listPortals;
        }
Esempio n. 2
0
 public static byte[] SendPortal(Portal portal)
 {
     Packet p = new Packet(200);
     p.WriteHexString("00");
     p.WriteInt(portal.ToMapID);
     p.WriteShort(portal.ToX);
     p.WriteShort(portal.ToY);
     p.WriteHexString("01");
     return p.GetWrittenBuffer(PacketIds.SendPortal);
 }
Esempio n. 3
0
        void c_ClientWalkToPortalInfo(object sender, ClientWalkToPortalEventArgs e)
        {
            Client c = (Client)sender;
            int MapID = e.MapID;
            Map m = GetMapEngine(MapID).Map;
            MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId);
            Client[] clients = GetClientsForChars(mapEngine.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray());

            Portal p = GetNearbyPortal(c);

            if (p != null)
            {
                c.MyCharacter.Position.X = p.ToX;
                c.MyCharacter.Position.Y = p.ToY;
                c.MyCharacter.OldMapId = c.MyCharacter.MapId;
                c.MyCharacter.MapId = p.ToMapID;
                c.MyCharacter.Map = m;

                characterManager.UpdateCharacter(c.MyCharacter);

                byte[] bufferRemoveMe = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.None);
                SendToClients(bufferRemoveMe, clients);

                if (c.MyCharacter.Pet != null && !c.MyCharacter.Pet.IsSealed)
                {
                    byte[] bufferRemovePet = PacketManager.SendRemovePet(c.MyCharacter.Pet);
                    SendToClients(bufferRemovePet, clients);

                    c.MyCharacter.Pet.Position.X = c.MyCharacter.Position.X;
                    c.MyCharacter.Pet.Position.Y = c.MyCharacter.Position.Y;
                    c.MyCharacter.Pet.MapID = c.MyCharacter.MapId;
                }

                byte[] bufferSendPortal = PacketManager.SendPortal(p);
                c.Send(bufferSendPortal);
            }
            else if (p == null && !c.MyCharacter.Alive)
            {
                Portal dead = new Portal()
                {
                    ToMapID = c.MyCharacter.MapId,
                    ToX = (short)c.MyCharacter.Map.SpawnX,
                    ToY = (short)c.MyCharacter.Map.SpawnY
                };

                c.MyCharacter.Position.X = (short)c.MyCharacter.Map.SpawnX;
                c.MyCharacter.Position.Y = (short)c.MyCharacter.Map.SpawnY;
                c.MyCharacter.Map = m;

                characterManager.UpdateCharacter(c.MyCharacter);

                byte[] bufferRemoveMe = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.None);
                SendToClients(bufferRemoveMe, clients);

                if (c.MyCharacter.Pet != null && !c.MyCharacter.Pet.IsSealed)
                {
                    byte[] bufferRemovePet = PacketManager.SendRemovePet(c.MyCharacter.Pet);
                    SendToClients(bufferRemovePet, clients);

                    c.MyCharacter.Pet.Position.X = c.MyCharacter.Position.X;
                    c.MyCharacter.Pet.Position.Y = c.MyCharacter.Position.Y;
                    c.MyCharacter.Pet.MapID = c.MyCharacter.MapId;
                }

                byte[] bufferSendPortal = PacketManager.SendPortal(dead);
                c.Send(bufferSendPortal);
            }
        }
Esempio n. 4
0
        void c_ClientUseTeleporterInfo(object sender, ClientUseTeleporterEventArgs e)
        {
            Client c = (Client)sender;
            UseTeleporterInfo i = e.Info;

            Map tomap = null;

            if (i.ToMap != 0)
                tomap = GetMapEngine(i.ToMap).Map; // its real bead which has mapid etc
            else
                tomap = GetMapEngine(c.MyCharacter.MapId).Map; // its either town portal scroll or bugged so its win/win for us

            Portal tempPort = new Portal
            {
                ToMapID = tomap.MapID,
                ToX = (short)tomap.SpawnX,
                ToY = (short)tomap.SpawnY
            };

            MapEngine oldMap = GetMapEngine(c.MyCharacter.MapId);
            Client[] clients = GetClientsForChars(oldMap.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray());

            byte[] SendRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.Bead);
            SendToClients(SendRemoveCharacter, clients);

            c.MyCharacter.Position.X = (short)tomap.SpawnX;
            c.MyCharacter.Position.Y = (short)tomap.SpawnY;
            c.MyCharacter.OldMapId = c.MyCharacter.MapId;
            c.MyCharacter.MapId = tomap.MapID;

            if (c.MyCharacter.Pet != null && !c.MyCharacter.Pet.IsSealed)
            {
                byte[] bufferRemovePet = PacketManager.SendRemovePet(c.MyCharacter.Pet);
                SendToClients(bufferRemovePet, clients);

                oldMap.ActiveClientEntities.Remove(c.MyCharacter.Pet);
                c.MyCharacter.Pet.Position.X = c.MyCharacter.Position.X;
                c.MyCharacter.Pet.Position.Y = c.MyCharacter.Position.Y;
                c.MyCharacter.Pet.MapID = c.MyCharacter.MapId;
            }
            MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId);

            c.MyCharacter.Map = mapEngine.Map;
            characterManager.UpdateCharacter(c.MyCharacter);

            byte[] SendPortal = PacketManager.SendPortal(tempPort);
            c.Send(SendPortal);
        }
Esempio n. 5
0
        void c_ClientUseItemInfo(object sender, ClientUseItemEventArgs e)
        {
            Client c = (Client)sender;
            UseItemInfo i = e.Info;
            BaseItem item = null;
            MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId);
            Client[] clients = GetClientsForChars(mapEngine.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray());
            bool removeItem = false;

            try
            {
                item = c.MyCharacter.Bags[i.Bag - 1].Items.Single(x => x.ItemID == i.ItemID);

                if (item != null && c.MyCharacter.Alive)
                {
                    if (item is Potion)
                    {
                        Potion p = item as Potion;
                        byte effect = 0;
                        if (c.MyCharacter.CurrentHp == c.MyCharacter.MaxHp && p.HealHp > 0 || c.MyCharacter.CurrentMana == c.MyCharacter.MaxMana && p.HealMana > 0)
                            return; // so it wont let you use potions when you dont need to use them. AKA u wont lose potion for nothing

                        if (p.HealHp != 0)
                        {
                            if (c.MyCharacter.CurrentHp + p.HealHp < c.MyCharacter.MaxHp)
                                c.MyCharacter.CurrentHp += p.HealHp;
                            else
                                c.MyCharacter.CurrentHp = c.MyCharacter.MaxHp;
                            effect = 1;
                        }
                        else
                        {
                            if (c.MyCharacter.CurrentMana + p.HealMana < c.MyCharacter.MaxMana)
                                c.MyCharacter.CurrentMana += p.HealMana;
                            else
                                c.MyCharacter.CurrentMana = c.MyCharacter.MaxMana;
                            effect = 2;
                        }

                        characterManager.UpdateCharacter(c.MyCharacter);
                        byte[] SendHealMana = PacketManager.SendHealMana(c.MyCharacter.MaxHp, c.MyCharacter.CurrentHp, c.MyCharacter.MaxMana, c.MyCharacter.CurrentMana, effect);
                        c.Send(SendHealMana);

                        removeItem = true;
                    }

                    if (item is Bead)
                    {
                        Bead b = item as Bead;

                        Map tomap = null;

                        if (b.ToMapID != 0)
                        {
                            MapEngine oldMap = GetMapEngine(c.MyCharacter.MapId);

                            tomap = GetMapEngine(b.ToMapID).Map; // its real bead which has mapid etc
                        }
                        else
                        {
                            tomap = GetMapEngine(c.MyCharacter.MapId).Map; // its either town portal scroll or bugged so its win/win for us
                        }

                        Portal tempPort = new Portal
                        {
                            ToMapID = tomap.MapID,
                            ToX = (short)tomap.SpawnX,
                            ToY = (short)tomap.SpawnY
                        };

                        if (b.ReferenceID == 21975) // BDC base bead
                        {
                            tempPort.ToX = 820;
                            tempPort.ToY = 816;
                        }

                        byte[] SendRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.Bead);
                        SendToClients(SendRemoveCharacter, clients);

                        c.MyCharacter.Position.X = tempPort.ToX;
                        c.MyCharacter.Position.Y = tempPort.ToY;
                        c.MyCharacter.OldMapId = c.MyCharacter.MapId;
                        c.MyCharacter.MapId = tempPort.ToMapID;

                        if (c.MyCharacter.Pet != null && !c.MyCharacter.Pet.IsSealed)
                        {
                            byte[] bufferRemovePet = PacketManager.SendRemovePet(c.MyCharacter.Pet);
                            SendToClients(bufferRemovePet, clients);

                            c.MyCharacter.Pet.Position.X = c.MyCharacter.Position.X;
                            c.MyCharacter.Pet.Position.Y = c.MyCharacter.Position.Y;
                            c.MyCharacter.Pet.MapID = c.MyCharacter.MapId;
                        }

                        c.MyCharacter.Map = mapEngine.Map;
                        characterManager.UpdateCharacter(c.MyCharacter);

                        byte[] SendPortal = PacketManager.SendPortal(tempPort);
                        c.Send(SendPortal);

                        removeItem = true;
                    }

                    if (item is BookItem)
                    {
                        BookItem book = item as BookItem;
                        BaseSkill skill = characterManager.GetSkillByLevelAndID(book.SkillID, book.SkillLevel);

                        // Need add so it saves the skill using LearnSkill procedure etc..
                        if (book is RebirthBook)
                        {
                            if (c.MyCharacter.Rebirth > 0)
                            {
                                RebirthBook rb = book as RebirthBook;
                                removeItem = LearnSkill(c, item, removeItem, skill, rb);
                            }
                            else
                            {
                                c.Send(PacketManager.SendSkillError(SkillLearnError.TooLowLevel));
                                return;
                            }
                        }
                        if (book is FocusBook)
                        {
                            if (c.MyCharacter.Rebirth > 6)
                            {
                                FocusBook focus = book as FocusBook;
                                removeItem = LearnSkill(c, item, removeItem, skill, focus);
                            }
                            else
                            {
                                c.Send(PacketManager.SendSkillError(SkillLearnError.TooLowLevel));
                                return;
                            }
                        }
                        if (book is HardBook)
                        {
                            HardBook hard = book as HardBook;
                            removeItem = LearnSkill(c, item, removeItem, skill, hard);
                        }
                        else
                        {
                            SoftBook soft = book as SoftBook;
                            removeItem = LearnSkill(c, item, removeItem, skill, soft);

                            byte[] SendStats = PacketManager.SendStats(c.MyCharacter);
                            c.Send(SendStats); // as it needs to update like dmg, def, ar, regens etc
                        }
                    }

                    if (item is StoreTag)
                    {
                        StoreTag tag = item as StoreTag;

                        byte[] SendPlayerShop = PacketManager.SendPlayerShop(c.MyCharacter, tag.TimeLeft);
                        c.Send(SendPlayerShop);
                    }

                    if (item is PetResurrectItem)
                    {
                        PetResurrectItem res = item as PetResurrectItem;

                        List<Pet> deadPets = petManager.GetLastDiedPets(c.MyCharacter.CharacterId);

                        byte[] SendLastDiedPets = PacketManager.SendLastDiedPets(deadPets);
                        c.Send(SendLastDiedPets);
                    }

                    if (removeItem) // just so it wont remove stuff like items from inventory just right clicking :(
                    {
                        if (item.Amount > 1)
                        {
                            item.Amount--;

                            byte[] SendRecvItemsLeft = PacketManager.SendItemsLeft(i.Bag, i.Slot, item.ItemID, item.Amount);
                            c.Send(SendRecvItemsLeft);

                            itemDataManager.UpdateItem(item);
                        }
                        else
                        {
                            byte[] SendRemoveItem = PacketManager.SendRemoveItem(item.Bag, item.Slot);
                            c.Send(SendRemoveItem);

                            c.MyCharacter.Bags[item.Bag - 1].RemoveItem(item);
                            itemDataManager.DeleteItem(item.ItemID);
                        }
                    }

                }
            }
            catch
            {
            }
        }
Esempio n. 6
0
        void c_ClientRequestDeath(object sender, ClientRequestDeath e)
        {
            Client c = (Client)sender;

            Portal p = new Portal
            {
                ToX = (short)c.MyCharacter.Map.SpawnX,
                ToY = (short)c.MyCharacter.Map.SpawnY,
                ToMapID = c.MyCharacter.MapId
            };

            if (c.MyCharacter.Position.X != p.ToX && c.MyCharacter.Position.Y != p.ToY)
            {
                c.MyCharacter.Position.X = p.ToX;
                c.MyCharacter.Position.Y = p.ToY;

                byte[] SendPortal = PacketManager.SendPortal(p);
                c.Send(SendPortal);

                byte[] SendPlayerDie1 = PacketManager.SendPlayerDie1(c.MyCharacter);
                c.Send(SendPlayerDie1);
            }
        }
Esempio n. 7
0
        void c_ClientChatMessageInfo(object sender, ClientChatMessageEventArgs e)
        {
            Client c = (Client)sender;
            ChatMessageInfo cmi = e.Info;

            MapEngine mapEngine = GetMapEngine(c.MyCharacter.MapId);
            Client[] Clients = GetClientsForChars(mapEngine.GetCharactersInRange(c.MyCharacter.Position, 150).ToArray());
            Client target = null;

            if (cmi.Type == ChatType.Whisper)
            {
                if (cmi.TargetName != "")
                    target = GetClientByName(cmi.TargetName);
                else
                    target = GetClientByCharacterID(cmi.TargetID);

                if (target != null)
                {
                    cmi.TargetID = target.MyCharacter.CharacterId;
                    byte[] bufferSendMessage = PacketManager.SendChatMessage(c.MyCharacter, cmi);
                    target.Send(bufferSendMessage);
                }
                else
                {
                    cmi.TargetID = 0;
                }

                byte[] bufferSendMessage2 = PacketManager.SendChatMessage(c.MyCharacter, cmi);
                c.Send(bufferSendMessage2);
            }
            if (cmi.Type == ChatType.Party)
            {
                if (c.MyCharacter.Party != null)
                {
                    byte[] bufferSendPartyMessage = PacketManager.SendChatMessage(c.MyCharacter, cmi);
                    foreach (Character ch in c.MyCharacter.Party.Members)
                    {
                        Client member = GetClientByCharacterID(ch.CharacterId);
                        if (member != null)
                        {
                            member.Send(bufferSendPartyMessage);
                        }
                    }
                }
            }
            if (cmi.Type == ChatType.General)
            {
                bool send = true;

                // COMMANDS FOR EVERYONE
                if (cmi.Message.StartsWith("."))
                {
                    string command = cmi.Message.Substring(1).ToLower();
                    string[] commands = command.Split(' ');

                    switch (commands[0])
                    {
                        case "add":
                            #region Add stats command
                            send = false;
                            if (commands.Length < 3)
                            {
                                SendCommandHelp("Usage: .add <stat> <amount>", c);
                                SendCommandHelp("Example: .add str 50", c);
                            }
                            else
                            {
                                try
                                {
                                    string stat = commands[1];
                                    short amount = Convert.ToInt16(commands[2]);
                                    if (amount < 0)
                                    {
                                        SendCommandHelp("Cannot input negative values", c);
                                        return;
                                    }
                                    if (amount > c.MyCharacter.StatPoint)
                                    {
                                        SendCommandHelp("Not enought stat points", c);
                                        return;
                                    }

                                    switch (stat)
                                    {
                                        case "str":
                                            c.MyCharacter.Strength += amount;
                                            c.MyCharacter.StatPoint -= amount;
                                            break;

                                        case "dex":
                                            c.MyCharacter.Dexterity += amount;
                                            c.MyCharacter.StatPoint -= amount;
                                            break;

                                        case "sta":
                                            c.MyCharacter.Stamina += amount;
                                            c.MyCharacter.StatPoint -= amount;
                                            break;

                                        case "ene":
                                            c.MyCharacter.Energy += amount;
                                            c.MyCharacter.StatPoint -= amount;
                                            break;

                                        default:
                                            SendCommandHelp("Stats available: str, dex, sta, ene", c);
                                            break;
                                    }

                                    c.Send(PacketManager.SendStats(c.MyCharacter));
                                    characterManager.UpdateCharacter(c.MyCharacter);
                                }
                                catch
                                {
                                }
                            }
                            #endregion
                            break;
                    }
                }

                // GM COMMANDS
                if (cmi.Message.StartsWith("!") && accountManager.IsGM(c.MyCharacter.AccountId))
                {
                    string command = cmi.Message.Substring(1).ToLower();
                    string[] commands = command.Split(' ');

                    switch (commands[0])
                    {
                        case "help":
                            #region Help Command
                            send = false;
                            SendCommandHelp("Commands:", c);
                            SendCommandHelp("! - sends text to everyone in game after !", c);
                            SendCommandHelp("!help - displays all commands", c);
                            SendCommandHelp("!levelup - gives enought exp to level up", c);
                            SendCommandHelp("!sp <value> - gives the amount of statpoints you enter", c);
                            SendCommandHelp("!tp <value> - gives the amount of trainingpoints you enter", c);
                            SendCommandHelp("!kick <player> - kicks the player", c);
                            SendCommandHelp("!goto <player> - warps next to the player", c);
                            #endregion
                            break;

                        case "levelup":
                            #region Levelup Command
                            send = false;
                            c.MyCharacter.CurrentExp += c.MyCharacter.ExpToLevel;
                            c.Send(PacketManager.SendStats(c.MyCharacter));
                            c.Send(PacketManager.SendExperience(c.MyCharacter, (int)c.MyCharacter.ExpToLevel, 0, false, false));
                            characterManager.UpdateCharacter(c.MyCharacter);
                            SendCommandHelp("Kill monster to level up!", c);
                            #endregion
                            break;

                        case "sp":
                            #region Statpoint Command
                            send = false;
                            if (commands.Length < 2)
                            {
                                SendCommandHelp("Usage: !sp <value>", c);
                            }
                            else
                            {
                                try
                                {
                                    short amount = Convert.ToInt16(commands[1]);
                                    if (c.MyCharacter.StatPoint + amount < 0)
                                        c.MyCharacter.StatPoint = 0;
                                    else
                                        c.MyCharacter.StatPoint += (short)amount;

                                    characterManager.UpdateCharacter(c.MyCharacter);
                                    c.Send(PacketManager.SendStats(c.MyCharacter));
                                }
                                catch
                                {
                                    SendCommandHelp("Too large input, max amount of statpoints is 32 500", c);
                                }
                            }
                            #endregion
                            break;

                        case "tp":
                            #region Tp Command
                            send = false;
                            if (commands.Length < 2)
                            {
                                SendCommandHelp("Usage: !tp <value>", c);
                            }
                            else
                            {
                                try
                                {
                                    short amount = Convert.ToInt16(commands[1]);
                                    if (c.MyCharacter.TrainingPoint + amount < 0)
                                        c.MyCharacter.TrainingPoint = 0;
                                    else
                                        c.MyCharacter.TrainingPoint += (short)amount;

                                    characterManager.UpdateCharacter(c.MyCharacter);
                                    c.Send(PacketManager.SendStats(c.MyCharacter));
                                }
                                catch
                                {
                                    SendCommandHelp("Too large input, max amount of tps is 32 500", c);
                                }
                            }
                            #endregion
                            break;

                        case "kick":
                            #region Kick Player Command
                            send = false;
                            if (commands.Length < 2)
                            {
                                SendCommandHelp("Usage: !kick <player>", c);
                            }
                            else
                            {
                                try
                                {
                                    Client tobeKicked = GetClientByName(commands[1]);
                                    if (tobeKicked == null)
                                        SendCommandHelp(string.Format("Player {0} does not exist", commands[1]), c);
                                    else
                                    {
                                        KickPlayer(tobeKicked.MyCharacter.Name);
                                        SendCommandHelp(string.Format("Player {0} has been kicked", commands[1]), c);
                                    }
                                }
                                catch
                                {
                                }
                            }
                            #endregion
                            break;

                        case "goto":
                            #region Goto Command
                            send = false;
                            if (commands.Length < 2)
                            {
                                SendCommandHelp("Usage: !goto <player>", c);
                            }
                            else
                            {
                                try
                                {
                                    Map tomap = null;
                                    Client player = GetClientByName(commands[1]);
                                    if (player != null)
                                    {
                                        if (player.MyCharacter.MapId != 0)
                                            tomap = GetMapEngine(player.MyCharacter.MapId).Map; // its real bead which has mapid etc
                                        else
                                            tomap = GetMapEngine(c.MyCharacter.MapId).Map; // its either town portal scroll or bugged so its win/win for us

                                        Portal tempPort = new Portal
                                        {
                                            ToMapID = tomap.MapID,
                                            ToX = (short)player.MyCharacter.Position.X,
                                            ToY = (short)player.MyCharacter.Position.Y
                                        };

                                        byte[] SendRemoveCharacter = PacketManager.SendRemoveCharacter(c.MyCharacter, RemoveCharacterEffect.Bead);
                                        SendToClients(SendRemoveCharacter, Clients);

                                        c.MyCharacter.Position.X = (short)tempPort.ToX;
                                        c.MyCharacter.Position.Y = (short)tempPort.ToY;
                                        c.MyCharacter.OldMapId = c.MyCharacter.MapId;
                                        c.MyCharacter.MapId = tomap.MapID;

                                        c.MyCharacter.Map = mapEngine.Map;
                                        characterManager.UpdateCharacter(c.MyCharacter);

                                        byte[] SendPortal = PacketManager.SendPortal(tempPort);
                                        c.Send(SendPortal);
                                    }
                                    else
                                        SendCommandHelp(string.Format("Player {0} is not online", commands[1]), c);
                                }
                                catch
                                {
                                }
                            }
                            #endregion
                            break;

                        case "money":
                            #region Money Command
                            send = false;
                            if (commands.Length < 2)
                            {
                                SendCommandHelp("Usage: !money <value>", c);
                            }
                            else
                            {
                                try
                                {
                                    int amount = Convert.ToInt32(commands[1]);
                                    if (c.MyCharacter.Money + amount < 0)
                                        c.MyCharacter.Money = 0;
                                    else
                                        c.MyCharacter.Money += amount;

                                    characterManager.UpdateCharacter(c.MyCharacter);
                                    c.Send(PacketManager.SendMoneyLeft(c.MyCharacter.Money));
                                }
                                catch
                                {
                                    SendCommandHelp("Too large input, max amount of money is 2,000,000,000", c);
                                }
                            }
                            #endregion
                            break;

                        case "random":
                            send = false;
                            SendCommandHelp(string.Format("Random test {0} {1}", XiahRandom.Next(0, 100), XiahRandom.Next(500, 900)), c);
                            break;

                        default:
                            cmi.Type = ChatType.Notice;
                            cmi.Message = string.Format("{0}: {1}", c.MyCharacter.Name, cmi.Message.Substring(1)); break;
                    }
                }

                if (send)
                {
                    byte[] bufferSendMessage = PacketManager.SendChatMessage(c.MyCharacter, cmi);
                    SendToClients(bufferSendMessage, clients.ToArray());
                }
            }
        }