30 static std::vector<ChatCommand> gobjectAddCommandTable =
35 static std::vector<ChatCommand> gobjectSetCommandTable =
40 static std::vector<ChatCommand> gobjectCommandTable =
52 static std::vector<ChatCommand> commandTable =
105 uint32 objectId = atol(
id);
109 char* spawntimeSecs = strtok(NULL,
" ");
123 SF_LOG_ERROR(
"sql.sql",
"Gameobject (Entry %u GoType: %u) have invalid displayId (%u), not spawned.", objectId, objectInfo->
type, objectInfo->
displayId);
139 if (!object->
Create(guidLow, objectInfo->
entry, map, x, y, z, o, 0.0f, 0.0f, 0.0f, 0.0f, 0,
GOState::GO_STATE_READY))
146 object->SetPhased(phase,
false,
true);
150 uint32 value = atoi((
char*)spawntimeSecs);
151 object->SetRespawnTime(value);
177 char*
id = strtok((
char*)args,
" ");
183 char* spawntime = strtok(NULL,
" ");
187 spawntm = atoi((
char*)spawntime);
194 float rot2 = std::sin(ang / 2);
195 float rot3 = std::cos(ang / 2);
197 uint32 objectId = atoi(
id);
199 player->
SummonGameObject(objectId, x, y, z, ang, 0, 0, rot2, rot3, spawntm);
217 uint32 objectId = atol(
id);
220 result =
WorldDatabase.PQuery(
"SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseId, (POW(position_x - '%f', 2) + POW(position_y - '%f', 2) + POW(position_z - '%f', 2)) AS order_ FROM gameobject WHERE map = '%i' AND id = '%u' ORDER BY order_ ASC LIMIT 1",
224 std::string name = id;
227 "SELECT guid, id, position_x, position_y, position_z, orientation, map, phaseId, (POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ "
228 "FROM gameobject, gameobject_template WHERE gameobject_template.entry = gameobject.id AND map = %i AND name " _LIKE_ " " _CONCAT3_(
"'%%'",
"'%s'",
"'%%'")
" ORDER BY order_ ASC LIMIT 1",
234 std::ostringstream eventFilter;
235 eventFilter <<
" AND (eventEntry IS NULL ";
236 bool initString =
true;
238 for (GameEventMgr::ActiveEvents::const_iterator itr = activeEventsList.begin(); itr != activeEventsList.end(); ++itr)
242 eventFilter <<
"OR eventEntry IN (" << *itr;
246 eventFilter <<
',' << *itr;
254 result =
WorldDatabase.PQuery(
"SELECT gameobject.guid, id, position_x, position_y, position_z, orientation, map, phaseId, "
255 "(POW(position_x - %f, 2) + POW(position_y - %f, 2) + POW(position_z - %f, 2)) AS order_ FROM gameobject "
256 "LEFT OUTER JOIN game_event_gameobject on gameobject.guid = game_event_gameobject.guid WHERE map = '%i' %s ORDER BY order_ ASC LIMIT 10",
269 uint32 guidLow, id, phase;
275 Field* fields = result->Fetch();
287 }
while (result->NextRow() && !found);
305 handler->
PSendSysMessage(
LANG_GAMEOBJECT_DETAIL, guidLow, objectInfo->
name.c_str(), guidLow,
id, x, y, z, mapId, o, phase);
310 if (curRespawnDelay < 0)
329 uint32 guidLow = atoi(
id);
346 uint64 ownerGuid =
object->GetOwnerGUID();
360 object->SetRespawnTime(0);
362 object->DeleteFromDB();
377 uint32 guidLow = atoi(
id);
394 char* orientation = strtok(NULL,
" ");
398 o = (float)atof(orientation);
406 object->UpdateRotationFields();
407 object->DestroyForNearbyPlayers();
408 object->UpdateObjectVisibility();
426 uint32 guidLow = atoi(
id);
443 char* toX = strtok(NULL,
" ");
444 char* toY = strtok(NULL,
" ");
445 char* toZ = strtok(NULL,
" ");
451 object->DestroyForNearbyPlayers();
452 object->UpdateObjectVisibility();
459 float x = (float)atof(toX);
460 float y = (float)atof(toY);
461 float z = (float)atof(toZ);
471 object->DestroyForNearbyPlayers();
472 object->UpdateObjectVisibility();
491 uint32 guidLow = atoi(
id);
508 char* phase = strtok(NULL,
" ");
509 uint32 phaseMask = phase ? atoi(phase) : 0;
517 object->SetPhaseMask(phaseMask,
true);
524 float distance = (!*args) ? 10.0f : (float)(atof(args));
537 stmt->
setFloat(7, distance * distance);
544 Field* fields = result->Fetch();
560 }
while (result->NextRow());
579 entry =
object->GetEntry();
581 entry = atoi((
char*)args);
584 entry = atoi((
char*)args);
591 type = gameObjectInfo->
type;
593 name = gameObjectInfo->
name;
615 uint32 guidLow = atoi(
id);
631 char* type = strtok(NULL,
" ");
635 int32 objectType = atoi(type);
638 if (objectType == -1)
639 object->SendObjectDeSpawnAnim(object->
GetGUID());
640 else if (objectType == -2)
645 char* state = strtok(NULL,
" ");
649 int32 objectState = atoi(state);
653 else if (objectType == 4)
656 data <<
object->GetGUID();
657 data << (
uint32)(objectState);
658 object->SendMessageToSet(&data,
true);
660 handler->
PSendSysMessage(
"Set gobject type %d state %d", objectType, objectState);
DBCStorage< GameObjectDisplayInfoEntry > sGameObjectDisplayInfoStore(GameObjectDisplayInfofmt)
#define _CONCAT3_(A, B, C)
@ LANG_COMMAND_DELOBJMESSAGE
@ LANG_COMMAND_TURNOBJMESSAGE
@ LANG_COMMAND_OBJNOTFOUND
@ LANG_GAMEOBJECT_HAVE_INVALID_DATA
@ LANG_COMMAND_MOVEOBJMESSAGE
@ LANG_GAMEOBJECT_NOT_EXIST
@ LANG_COMMAND_TARGETOBJNOTFOUND
@ LANG_COMMAND_NEAROBJMESSAGE
@ LANG_INVALID_TARGET_COORD
@ LANG_COMMAND_RAWPAWNTIMES
@ LANG_COMMAND_DELOBJREFERCREATURE
#define SF_LOG_ERROR(filterType__,...)
uint32 GUID_LOPART(uint64 x)
uint64 MAKE_NEW_GUID(uint32 l, uint32 e, uint32 h)
bool IS_PLAYER_GUID(uint64 guid)
Skyfire::AutoPtr< PreparedResultSet, Skyfire::Mutex > PreparedQueryResult
Skyfire::AutoPtr< ResultSet, Skyfire::Mutex > QueryResult
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_FIELD_STATE_SPELL_VISUAL_ID
std::string secsToTimeString(uint64 timeInSecs, bool shortText, bool hoursOnly)
@ WORLD_SEL_GAMEOBJECT_NEAREST
GameObject * GetObjectGlobalyWithGuidOrNearWithDbGuid(uint32 lowguid, uint32 entry)
WorldSession * GetSession()
char * extractKeyFromLink(char *text, char const *linkType, char **something1=NULL)
void PSendSysMessage(const char *format,...) ATTR_PRINTF(2
void SetSentErrorMessage(bool val)
WorldObject * getSelectedObject()
virtual void SendSysMessage(const char *str)
CommandScript(const char *name)
std::set< uint16 > ActiveEvents
uint32 GetRespawnDelay() const
GameObjectTemplate const * GetGOInfo() const
bool Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit=0)
bool LoadGameObjectFromDB(uint32 guid, Map *map, bool addToMap=true)
time_t GetRespawnTimeEx() const
void SetLootState(LootState s, Unit *unit=NULL)
uint8 GetSpawnMode() const
GameObject * GetGameObject(uint64 guid)
static bool IsValidMapCoord(uint32 mapid, float x, float y)
static Unit * GetUnit(WorldObject const &, uint64 guid)
uint32 GetGUIDLow() const
void setFloat(const uint8 index, const float value)
void setUInt32(const uint8 index, const uint32 value)
void RemoveGameObject(GameObject *gameObj, bool del)
std::set< uint32 > const & GetPhases() const
GameObject * SummonGameObject(uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
Player * GetPlayer() const
static bool HandleGameObjectDeleteCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectSetPhaseCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectTurnCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectInfoCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectMoveCommand(ChatHandler *handler, char const *args)
std::vector< ChatCommand > GetCommands() const
static bool HandleGameObjectAddTempCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectActivateCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectAddCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectSetStateCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectNearCommand(ChatHandler *handler, char const *args)
static bool HandleGameObjectTargetCommand(ChatHandler *handler, char const *args)
void AddSC_gobject_commandscript()
WorldDatabaseWorkerPool WorldDatabase
Accessor to the world database.
@ SMSG_GAMEOBJECT_CUSTOM_ANIM
@ RBAC_PERM_COMMAND_GOBJECT_ADD
@ RBAC_PERM_COMMAND_GOBJECT_SET_PHASE
@ RBAC_PERM_COMMAND_GOBJECT_SET_STATE
@ RBAC_PERM_COMMAND_GOBJECT_DELETE
@ RBAC_PERM_COMMAND_GOBJECT_SET
@ RBAC_PERM_COMMAND_GOBJECT
@ RBAC_PERM_COMMAND_GOBJECT_INFO
@ RBAC_PERM_COMMAND_GOBJECT_ACTIVATE
@ RBAC_PERM_COMMAND_GOBJECT_TARGET
@ RBAC_PERM_COMMAND_GOBJECT_NEAR
@ RBAC_PERM_COMMAND_GOBJECT_MOVE
@ RBAC_PERM_COMMAND_GOBJECT_TURN
@ RBAC_PERM_COMMAND_GOBJECT_ADD_TEMP
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@154136051106040324176270267211357174344063050360 chest
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@243266127071011160240350104214013054067132104252 fishinghole
float GetPositionZ() const
float GetOrientation() const
float GetPositionX() const
float GetPositionY() const
void Relocate(float x, float y)