9
3

TradeskillsDB.cpp 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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. #ifdef WIN32
  17. #include <WinSock2.h>
  18. #include <windows.h>
  19. #endif
  20. #include <mysql.h>
  21. #include <assert.h>
  22. #include "../../common/Log.h"
  23. #include "../WorldDatabase.h"
  24. #include "Tradeskills.h"
  25. extern MasterTradeskillEventsList master_tradeskillevent_list;
  26. void WorldDatabase::LoadTradeskillEvents() {
  27. TradeskillEvent* TSEvent = 0;
  28. Query query;
  29. MYSQL_ROW row;
  30. MYSQL_RES *res;
  31. res = query.RunQuery2(Q_SELECT, "SELECT `name`,`icon`,`technique`,`success_progress`,`success_durability`,`success_hp`,`success_power`,`success_spell_id`,`success_item_id`,`fail_progress`,`fail_durability`,`fail_hp`, `fail_power`\n"
  32. "FROM `tradeskillevents`");
  33. if (res) {
  34. while ((row = mysql_fetch_row(res))) {
  35. TSEvent = new TradeskillEvent;
  36. strncpy(TSEvent->Name, row[0], sizeof(TSEvent->Name));
  37. TSEvent->Icon = atoi(row[1]);
  38. TSEvent->Technique = atoul(row[2]);
  39. TSEvent->SuccessProgress = atoi(row[3]);
  40. TSEvent->SuccessDurability = atoi(row[4]);
  41. TSEvent->SuccessHP = atoi(row[5]);
  42. TSEvent->SuccessPower = atoi(row[6]);
  43. TSEvent->SuccessSpellID = atoul(row[7]);
  44. TSEvent->SuccessItemID = atoul(row[8]);
  45. TSEvent->FailProgress = atoi(row[9]);
  46. TSEvent->FailDurability = atoi(row[10]);
  47. TSEvent->FailHP = atoi(row[11]);
  48. TSEvent->FailPower = atoi(row[12]);
  49. LogWrite(TRADESKILL__DEBUG, 7, "Tradeskills", "Loading tradeskill event: %s", TSEvent->Name);
  50. master_tradeskillevent_list.AddEvent(TSEvent);
  51. }
  52. }
  53. LogWrite(TRADESKILL__DEBUG, 0, "Tradeskills", "\tLoaded %u tradeskill events", master_tradeskillevent_list.Size());
  54. }