Pelf

Pelf level2

Apr 24th, 2012
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.74 KB | None | 0 0
  1. diff --git a/src/server/game/Chat/Commands/Level2.cpp b/src/server/game/Chat/Commands/Level2.cpp
  2. index 4c48764..1205898 100644
  3. --- a/src/server/game/Chat/Commands/Level2.cpp
  4. +++ b/src/server/game/Chat/Commands/Level2.cpp
  5. @@ -3380,6 +3380,41 @@ bool ChatHandler::HandleTitlesRemoveCommand(const char* args)
  6.          PSendSysMessage(LANG_CURRENT_TITLE_RESET, tNameLink.c_str());
  7.      }
  8.  
  9. +   //temp
  10. +   HashMapHolder<Player>::MapType const& plist = sObjectAccessor->GetPlayers();
  11. +    for (HashMapHolder<Player>::MapType::const_iterator itr = plist.begin(); itr != plist.end(); ++itr)
  12. +   {
  13. +       Player* player = itr->second;
  14. +       target->SetUInt32Value(PLAYER_CHOSEN_TITLE,0);
  15. +       player->SetTitle(titleInfo, true);
  16. +   }
  17. +   uint32 fieldIndexOffset = titleInfo->bit_index / 32;
  18. +   sLog->outDebug("OFFSET %u, BIT INDEX %u", fieldIndexOffset, titleInfo->bit_index);
  19. +    uint32 flag = 1 << (titleInfo->bit_index % 32);
  20. +   uint32 titles[12];
  21. +   QueryResult result = CharacterDatabase.PQuery("SELECT guid, knowntitles FROM characters");
  22. +   do
  23. +   {
  24. +       Field* fields = result->Fetch();
  25. +       uint64 guid = fields[0].GetInt64();
  26. +       Tokens tokens(fields[1].GetCString(), ' ', KNOWN_TITLES_SIZE);
  27. +      
  28. +       for (uint8 i = 0; i < KNOWN_TITLES_SIZE; i++)
  29. +           titles[i] = atol(tokens[i]);
  30. +       if (titles[fieldIndexOffset] & flag)
  31. +       {
  32. +           uint32 oldval = titles[fieldIndexOffset];
  33. +           uint32 newval = oldval & ~flag;
  34. +           titles[fieldIndexOffset] = newval;
  35. +       }
  36. +       std::ostringstream ss;
  37. +       ss << "UPDATE characters SET chosentitle = 0, knowntitles = '";
  38. +       for (uint8 i = 0; i < KNOWN_TITLES_SIZE; i++)
  39. +           ss << titles[i] << " ";
  40. +       ss << "' WHERE guid =" << guid;
  41. +       CharacterDatabase.PExecute(ss.str().c_str());
  42. +   }while (result->NextRow());
  43. +
  44.      return true;
  45.  }
Advertisement
Add Comment
Please, Sign In to add comment