Advertisement
Rochet2

.gob scale ~ crap version

Apr 10th, 2012
631
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 2.48 KB | None | 0 0
  1. diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
  2. index 74b8272..ba515e9 100644
  3. --- a/src/server/scripts/Commands/cs_gobject.cpp
  4. +++ b/src/server/scripts/Commands/cs_gobject.cpp
  5. @@ -57,6 +57,7 @@ public:
  6.              { "near",           SEC_GAMEMASTER,     false, &HandleGameObjectNearCommand,      "", NULL },
  7.              { "target",         SEC_GAMEMASTER,     false, &HandleGameObjectTargetCommand,    "", NULL },
  8.              { "turn",           SEC_GAMEMASTER,     false, &HandleGameObjectTurnCommand,      "", NULL },
  9. +            { "scale",          SEC_GAMEMASTER,     false, &HandleGameObjectScaleCommand,     "", NULL },
  10.              { "add",            SEC_GAMEMASTER,     false, NULL,            "", gobjectAddCommandTable },
  11.              { "set",            SEC_GAMEMASTER,     false, NULL,            "", gobjectSetCommandTable },
  12.              { NULL,             0,                  false, NULL,                              "", NULL }
  13. @@ -69,6 +70,52 @@ public:
  14.          return commandTable;
  15.      }
  16.  
  17. +   static bool HandleGameObjectScaleCommand(ChatHandler* handler, const char* args)
  18. +   {
  19. +       // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
  20. +       char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
  21. +       if (!id)
  22. +           return false;
  23. +
  24. +       uint32 guidLow = atoi(id);
  25. +       if (!guidLow)
  26. +           return false;
  27. +
  28. +       GameObject* object = NULL;
  29. +
  30. +       // by DB guid
  31. +       if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
  32. +           object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
  33. +
  34. +       if (!object)
  35. +       {
  36. +           handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
  37. +           handler->SetSentErrorMessage(true);
  38. +           return false;
  39. +       }
  40. +          
  41. +       char* pScale = strtok(NULL, " ");
  42. +       if(!pScale)
  43. +           return false;
  44. +
  45. +       float Scale = (float)atof(pScale);
  46. +       if (Scale > 10.0f || Scale < 0.1f)
  47. +       {
  48. +           handler->SendSysMessage(LANG_BAD_VALUE);
  49. +           handler->SetSentErrorMessage(true);
  50. +           return false;
  51. +       }
  52. +       WorldDatabase.PExecute("UPDATE gameobject_template SET size = %f WHERE entry = %u", Scale, object->GetEntry());
  53. +       object->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
  54. +       object->DestroyForNearbyPlayers();
  55. +       object->UpdateObjectVisibility();
  56. +
  57. +       object->SaveToDB();
  58. +       object->Refresh();
  59. +
  60. +       return true;
  61. +   }
  62. +
  63.      static bool HandleGameObjectActivateCommand(ChatHandler* handler, char const* args)
  64.      {
  65.          if (!*args)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement