Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff --git a/src/server/scripts/Commands/cs_gobject.cpp b/src/server/scripts/Commands/cs_gobject.cpp
- index 74b8272..ba515e9 100644
- --- a/src/server/scripts/Commands/cs_gobject.cpp
- +++ b/src/server/scripts/Commands/cs_gobject.cpp
- @@ -57,6 +57,7 @@ public:
- { "near", SEC_GAMEMASTER, false, &HandleGameObjectNearCommand, "", NULL },
- { "target", SEC_GAMEMASTER, false, &HandleGameObjectTargetCommand, "", NULL },
- { "turn", SEC_GAMEMASTER, false, &HandleGameObjectTurnCommand, "", NULL },
- + { "scale", SEC_GAMEMASTER, false, &HandleGameObjectScaleCommand, "", NULL },
- { "add", SEC_GAMEMASTER, false, NULL, "", gobjectAddCommandTable },
- { "set", SEC_GAMEMASTER, false, NULL, "", gobjectSetCommandTable },
- { NULL, 0, false, NULL, "", NULL }
- @@ -69,6 +70,52 @@ public:
- return commandTable;
- }
- + static bool HandleGameObjectScaleCommand(ChatHandler* handler, const char* args)
- + {
- + // number or [name] Shift-click form |color|Hgameobject:go_id|h[name]|h|r
- + char* id = handler->extractKeyFromLink((char*)args, "Hgameobject");
- + if (!id)
- + return false;
- +
- + uint32 guidLow = atoi(id);
- + if (!guidLow)
- + return false;
- +
- + GameObject* object = NULL;
- +
- + // by DB guid
- + if (GameObjectData const* gameObjectData = sObjectMgr->GetGOData(guidLow))
- + object = handler->GetObjectGlobalyWithGuidOrNearWithDbGuid(guidLow, gameObjectData->id);
- +
- + if (!object)
- + {
- + handler->PSendSysMessage(LANG_COMMAND_OBJNOTFOUND, guidLow);
- + handler->SetSentErrorMessage(true);
- + return false;
- + }
- +
- + char* pScale = strtok(NULL, " ");
- + if(!pScale)
- + return false;
- +
- + float Scale = (float)atof(pScale);
- + if (Scale > 10.0f || Scale < 0.1f)
- + {
- + handler->SendSysMessage(LANG_BAD_VALUE);
- + handler->SetSentErrorMessage(true);
- + return false;
- + }
- + WorldDatabase.PExecute("UPDATE gameobject_template SET size = %f WHERE entry = %u", Scale, object->GetEntry());
- + object->SetFloatValue(OBJECT_FIELD_SCALE_X, Scale);
- + object->DestroyForNearbyPlayers();
- + object->UpdateObjectVisibility();
- +
- + object->SaveToDB();
- + object->Refresh();
- +
- + return true;
- + }
- +
- static bool HandleGameObjectActivateCommand(ChatHandler* handler, char const* args)
- {
- if (!*args)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement