9
3

ChatDB.cpp 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. /*
  2. EQ2Emulator: Everquest II Server Emulator
  3. Copyright (C) 2007 EQ2EMulator Development Team (http://www.eq2emulator.net)
  4. This file is part of EQ2Emulator.
  5. EQ2Emulator is free software: you can redistribute it and/or modify
  6. it under the terms of the GNU General Public License as published by
  7. the Free Software Foundation, either version 3 of the License, or
  8. (at your option) any later version.
  9. EQ2Emulator is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License for more details.
  13. You should have received a copy of the GNU General Public License
  14. along with EQ2Emulator. If not, see <http://www.gnu.org/licenses/>.
  15. */
  16. #include "../../common/Log.h"
  17. #include "Chat.h"
  18. #include "../WorldDatabase.h"
  19. extern Chat chat;
  20. void WorldDatabase::LoadChannels() {
  21. DatabaseResult result;
  22. ChatChannel *channel;
  23. if (database_new.Select(&result, "SELECT `name`,`password`,`level_restriction`,`classes`,`races` FROM `channels`")) {
  24. while (result.Next()) {
  25. channel = new ChatChannel();
  26. channel->SetName(result.GetString(0));
  27. if (!result.IsNull(1))
  28. channel->SetPassword(result.GetString(1));
  29. channel->SetLevelRestriction(result.GetInt16(2));
  30. channel->SetClassesAllowed(result.GetInt64(3));
  31. channel->SetRacesAllowed(result.GetInt64(4));
  32. channel->SetType(CHAT_CHANNEL_TYPE_WORLD);
  33. chat.AddChannel(channel);
  34. }
  35. }
  36. }